diff --git a/app/models/e_paper_topic.rb b/app/models/e_paper_topic.rb index fbf49b3..a57e1db 100644 --- a/app/models/e_paper_topic.rb +++ b/app/models/e_paper_topic.rb @@ -24,6 +24,6 @@ class EPaperTopic end def criteria_title - PaperCriteria.where(:start_date.lte => self.period, :end_date.gte => self.period).first.title rescue "" + PaperCriteria.where(:start_date.lte => self.period.in_time_zone(Time.zone.utc_offset / 3600), :end_date.gte => self.period.in_time_zone(Time.zone.utc_offset / 3600)).first.title rescue "" end end \ No newline at end of file diff --git a/app/models/paper_criteria.rb b/app/models/paper_criteria.rb index 8569e22..a927f1e 100644 --- a/app/models/paper_criteria.rb +++ b/app/models/paper_criteria.rb @@ -16,8 +16,8 @@ class PaperCriteria def epaper_topics - tmp = EPaperTopic.where(:period.gte => self.start_date, :period.lte => self.end_date).can_display - tmp = EPaperTopic.where(:period.gte => self.start_date, :period.lte => self.end_date).limit(1) if tmp.first.nil? + tmp = EPaperTopic.where(:period.gte => self.start_date.in_time_zone(Time.zone.utc_offset / 3600), :period.lte => self.end_date.in_time_zone(Time.zone.utc_offset / 3600)).can_display + tmp = EPaperTopic.where(:period.gte => self.start_date.in_time_zone(Time.zone.utc_offset / 3600), :period.lte => self.end_date.in_time_zone(Time.zone.utc_offset / 3600)).limit(1) if tmp.first.nil? tmp end