Enable blind voting

This commit is contained in:
Stella Rouzi 2016-07-05 16:44:53 +03:00 committed by differentreality
parent 8388385b51
commit 59eeb7edbd
17 changed files with 391 additions and 108 deletions

View file

@ -1,4 +1,16 @@
module ApplicationHelper
##
# Checks if the voting has already started, or if it has already ended
#
def voting_open_or_close(program)
return if program.voting_period?
if program.voting_start_date > Date.today
return 'Voting period has not started yet!'
else # voting_end_date > Date.today because voting_start_date < voting_end_date
return 'Voting period is over!'
end
end
##
# Gets an EventType object, and returns its length in timestamp format (HH:MM)
# ====Gets
@ -9,6 +21,15 @@ module ApplicationHelper
[length / 60, length % 60].map { |t| t.to_s.rjust(2, '0') }.join(':')
end
##
# Gets a datetime object
# ====Returns
# * +String+ -> formated datetime object
def format_datetime(obj)
return unless obj
obj.strftime('%Y-%m-%d %H:%M')
end
##
# ====Returns
# * +String+ -> number of registrations / max allowed registrations