From 23c14f82f830da5c8ddffd087de63ad14885ba7e Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 3 May 2021 03:36:55 -0700 Subject: [PATCH] Fix show_voting? so it is true even during the voting period --- app/models/program.rb | 3 ++- app/views/admin/events/_voting.html.haml | 8 ++++---- spec/models/program_spec.rb | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/program.rb b/app/models/program.rb index e0196099..f9e851bf 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -117,7 +117,8 @@ class Program < ApplicationRecord def show_voting? return true unless blind_voting - Time.current > voting_end_date + # TODO-SNAPCON: UPDATE TESTS + # Time.current > voting_end_date end ## diff --git a/app/views/admin/events/_voting.html.haml b/app/views/admin/events/_voting.html.haml index e0388663..e0baa050 100644 --- a/app/views/admin/events/_voting.html.haml +++ b/app/views/admin/events/_voting.html.haml @@ -22,20 +22,20 @@ - if voting_period - max_rating.times do |counter| - if event.user_rating(current_user) > counter - = link_to '', + = link_to('', vote_admin_conference_program_event_path(conference_id, event, rating: counter + 1), remote: true, id: "label#{counter + 1}", class: 'rating myrating bright', - voted: true + voted: true) - else - = link_to '', + = link_to('', vote_admin_conference_program_event_path(conference_id, event, rating: counter + 1), remote: true, id: "label#{counter + 1}", - class: 'rating myrating' + class: 'rating myrating') - else = rating_stars(event.user_rating(current_user), max_rating, voted: true) (Voting period is closed) diff --git a/spec/models/program_spec.rb b/spec/models/program_spec.rb index 469092e3..a31701b1 100644 --- a/spec/models/program_spec.rb +++ b/spec/models/program_spec.rb @@ -119,9 +119,10 @@ describe Program do expect(program.show_voting?).to eq true end + # TODO-SNAPCON: This should be updated / removed. it 'returns false if we are still in votig period' do program.voting_end_date = Date.today + 1 - expect(program.show_voting?).to eq false + expect(program.show_voting?).to eq true end end end