Issue #649: Wrong days remaining label when submitting a new proposal

This commit is contained in:
raluka 2015-08-21 19:15:02 +02:00
parent 124d275a09
commit 1de8f979cd
4 changed files with 23 additions and 18 deletions

View file

@ -63,6 +63,11 @@ class CallForPaper < ActiveRecord::Base
&& !self.conference.email_settings.call_for_papers_dates_updates_template.blank? && !self.conference.email_settings.call_for_papers_dates_updates_template.blank?
end end
def remaining_days(date = Date.today)
result = (self.end_date - date).to_i
result > 0 ? result : 0
end
private private
def before_end_of_conference def before_end_of_conference

View file

@ -19,8 +19,7 @@
%dt %dt
Days Left: Days Left:
%dd %dd
- days = (@call_for_paper.end_date - Date.today).to_i = pluralize(@call_for_paper.remaining_days, 'day')
= pluralize(days, 'days')
%dt %dt
Event types: Event types:
%dd %dd

View file

@ -25,14 +25,15 @@
and closes and closes
%em %em
= @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.') = @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.')
That means you have only - if @conference.cfp_open?
- days = (@conference.call_for_paper.end_date - Date.today).to_i That means you have only
%b %b= pluralize(@conference.call_for_paper.remaining_days, 'day')
= pluralize(days, 'days')
left! left!
Remember Remember
= @conference.short_title = @conference.short_title
will only be as good as the sessions you present. Submit early, submit often! will only be as good as the sessions you present. Submit early, submit often!
- else
The submission period is closed.
.row .row
.col-md-12.text-center .col-md-12.text-center
%p.cta-button %p.cta-button

View file

@ -6,18 +6,18 @@
Proposals should fit in one of the Proposals should fit in one of the
= "#{pluralize(@conference.tracks.count, 'track')}:" = "#{pluralize(@conference.tracks.count, 'track')}:"
= "#{tracks(@conference)}." = "#{tracks(@conference)}."
- if @conference.call_for_paper - if @conference.cfp_open?
The submission period has begun The submission period has begun
%em %em
= @conference.call_for_paper.start_date.strftime('%A, %B %-d. %Y') = @conference.call_for_paper.start_date.strftime('%A, %B %-d. %Y')
and closes and closes
%em %em
= @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.') = @conference.call_for_paper.end_date.strftime('%A, %B %-d. %Y.')
That means you have only That means you have
- days = (@conference.call_for_paper.end_date - Date.today).to_i %b= pluralize(@conference.call_for_paper.remaining_days, 'day')
%b left!
= pluralize(days, 'days') Remember
left! = @conference.title
Remember will only be as good as the content you present. Submit early, submit often!
= @conference.title -else
will only be as good as the content you present. Submit early, submit often! The submission period is closed now.