From 1383483a54296d2ae3e093b89f52a68fe10a8277 Mon Sep 17 00:00:00 2001 From: Peng DU Date: Wed, 22 Jun 2016 17:27:14 +0200 Subject: [PATCH] dont compute member list if not complete --- app/services/statistic_service.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/services/statistic_service.rb b/app/services/statistic_service.rb index f6b4239a3..cdd42a100 100644 --- a/app/services/statistic_service.rb +++ b/app/services/statistic_service.rb @@ -252,10 +252,12 @@ class StatisticService def members_list(options = default_options) result = [] - User.with_role(:member).where('users.created_at >= :start_date AND users.created_at <= :end_date', options).each do |u| - result.push OpenStruct.new({ - date: options[:start_date].to_date - }.merge(user_info(u))) + User.with_role(:member).includes(:profile).where('users.created_at >= :start_date AND users.created_at <= :end_date', options).each do |u| + if !u.need_completion? + result.push OpenStruct.new({ + date: options[:start_date].to_date + }.merge(user_info(u))) + end end result end