Fix show_voting? so it is true even during the voting period

This commit is contained in:
Michael Ball 2021-05-03 03:36:55 -07:00
parent 653395c123
commit 23c14f82f8
3 changed files with 8 additions and 6 deletions

View file

@ -117,7 +117,8 @@ class Program < ApplicationRecord
def show_voting? def show_voting?
return true unless blind_voting return true unless blind_voting
Time.current > voting_end_date # TODO-SNAPCON: UPDATE TESTS
# Time.current > voting_end_date
end end
## ##

View file

@ -22,20 +22,20 @@
- if voting_period - if voting_period
- max_rating.times do |counter| - max_rating.times do |counter|
- if event.user_rating(current_user) > counter - if event.user_rating(current_user) > counter
= link_to '', = link_to('',
vote_admin_conference_program_event_path(conference_id, vote_admin_conference_program_event_path(conference_id,
event, rating: counter + 1), event, rating: counter + 1),
remote: true, remote: true,
id: "label#{counter + 1}", id: "label#{counter + 1}",
class: 'rating myrating bright', class: 'rating myrating bright',
voted: true voted: true)
- else - else
= link_to '', = link_to('',
vote_admin_conference_program_event_path(conference_id, vote_admin_conference_program_event_path(conference_id,
event, rating: counter + 1), event, rating: counter + 1),
remote: true, remote: true,
id: "label#{counter + 1}", id: "label#{counter + 1}",
class: 'rating myrating' class: 'rating myrating')
- else - else
= rating_stars(event.user_rating(current_user), max_rating, voted: true) = rating_stars(event.user_rating(current_user), max_rating, voted: true)
(Voting period is closed) (Voting period is closed)

View file

@ -119,9 +119,10 @@ describe Program do
expect(program.show_voting?).to eq true expect(program.show_voting?).to eq true
end end
# TODO-SNAPCON: This should be updated / removed.
it 'returns false if we are still in votig period' do it 'returns false if we are still in votig period' do
program.voting_end_date = Date.today + 1 program.voting_end_date = Date.today + 1
expect(program.show_voting?).to eq false expect(program.show_voting?).to eq true
end end
end end
end end