fix error
This commit is contained in:
parent
fff118ac71
commit
bae6f2cf17
|
@ -73,7 +73,7 @@ class Site
|
||||||
mount_uploader :mobile_icon, ImageUploader
|
mount_uploader :mobile_icon, ImageUploader
|
||||||
Impression.class_eval{
|
Impression.class_eval{
|
||||||
def self.group_by(field,day_limit,start_day=Date.today,format = 'day')
|
def self.group_by(field,day_limit,start_day=Date.today,format = 'day')
|
||||||
limit_ele = self.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 || self.first
|
||||||
key_op = [['year','$year'],['month', '$month'], ['day', '$dayOfMonth']]
|
key_op = [['year','$year'],['month', '$month'], ['day', '$dayOfMonth']]
|
||||||
key_op = key_op.take(1 + key_op.find_index { |key, op| format == key })
|
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]
|
project_date_fields = Hash[*key_op.collect { |key, op| [key, {op => "$#{field}"}] }.flatten]
|
||||||
|
|
Loading…
Reference in New Issue