Commit 85990249f123d94da90c5aab09e9585cc8aac840
1 parent
9630118f
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Fix track date
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
plugins/community_track/lib/community_track_plugin/step.rb
| @@ -76,20 +76,20 @@ class CommunityTrackPlugin::Step < Folder | @@ -76,20 +76,20 @@ class CommunityTrackPlugin::Step < Folder | ||
| 76 | end | 76 | end |
| 77 | 77 | ||
| 78 | def active? | 78 | def active? |
| 79 | - (start_date..end_date).include?(Date.today) | 79 | + (start_date.to_date..end_date.to_date).include?(Date.today) |
| 80 | end | 80 | end |
| 81 | 81 | ||
| 82 | def finished? | 82 | def finished? |
| 83 | - Date.today > end_date | 83 | + Date.today > end_date.to_date |
| 84 | end | 84 | end |
| 85 | 85 | ||
| 86 | def waiting? | 86 | def waiting? |
| 87 | - Date.today < start_date | 87 | + Date.today < start_date.to_date |
| 88 | end | 88 | end |
| 89 | 89 | ||
| 90 | def schedule_activation | 90 | def schedule_activation |
| 91 | return if !changes['start_date'] && !changes['end_date'] | 91 | return if !changes['start_date'] && !changes['end_date'] |
| 92 | - if Date.today <= end_date || accept_comments | 92 | + if Date.today <= end_date.to_date || accept_comments |
| 93 | schedule_date = !accept_comments ? start_date : end_date + 1.day | 93 | schedule_date = !accept_comments ? start_date : end_date + 1.day |
| 94 | CommunityTrackPlugin::ActivationJob.find(id).destroy_all | 94 | CommunityTrackPlugin::ActivationJob.find(id).destroy_all |
| 95 | Delayed::Job.enqueue(CommunityTrackPlugin::ActivationJob.new(self.id), :run_at => schedule_date) | 95 | Delayed::Job.enqueue(CommunityTrackPlugin::ActivationJob.new(self.id), :run_at => schedule_date) |