From e6484f4a69273d1202ae189086719cc5aed0e5cb Mon Sep 17 00:00:00 2001 From: chiu Date: Tue, 3 Mar 2020 21:11:12 +0800 Subject: [PATCH] fix error --- temp_file/app/models/site.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/temp_file/app/models/site.rb b/temp_file/app/models/site.rb index 7bf7d57..c78e4ca 100644 --- a/temp_file/app/models/site.rb +++ b/temp_file/app/models/site.rb @@ -73,7 +73,7 @@ class Site mount_uploader :mobile_icon, ImageUploader Impression.class_eval{ def self.group_by(field,day_limit,start_day=Date.today,format = 'day') - limit_ele = Impression.desc(:id).where({ created_at: { "$lt" => start_day-(day_limit-2).days }}).first + limit_ele = self.desc(:id).where({ created_at: { "$lt" => start_day-(day_limit-2).days }}).first key_op = [['year','$year'],['month', '$month'], ['day', '$dayOfMonth']] key_op = key_op.take(1 + key_op.find_index { |key, op| format == key }) project_date_fields = Hash[*key_op.collect { |key, op| [key, {op => "$#{field}"}] }.flatten]