lock voting when interview status not pending

This commit is contained in:
Mark Moser 2016-12-04 16:19:16 -06:00
parent bc31f6cf17
commit 73df3d1258
3 changed files with 20 additions and 6 deletions

View File

@ -3,12 +3,21 @@
<% if current_user.acts_as_reviewer? %> <% if current_user.acts_as_reviewer? %>
<div class="review_meta__votes" data-id="vote-count"> <div class="review_meta__votes" data-id="vote-count">
<strong>Votes: </strong> <strong>Votes: </strong>
<%= link_to admin_up_vote_path(test_hash: @candidate.test_hash), remote: true do %>
Yea (<span data-id="up-votes"><%= @candidate.votes.yea.count %></span>) <% if @candidate.pending? %>
<% end %> <%= link_to admin_up_vote_path(test_hash: @candidate.test_hash), remote: true do %>
<%= link_to admin_down_vote_path(test_hash: @candidate.test_hash), remote: true do %> Yea (<span data-id="up-votes"><%= @candidate.votes.yea.count %></span>)
Nay (<span data-id="down-votes"><%= @candidate.votes.nay.count %></span>) <% end %>
<%= link_to admin_down_vote_path(test_hash: @candidate.test_hash), remote: true do %>
Nay (<span data-id="down-votes"><%= @candidate.votes.nay.count %></span>)
<% end %>
<% else %>
Voting closed -
Yea (<%= @candidate.votes.yea.count %>) -
Nay (<%= @candidate.votes.nay.count %>)
<% end %> <% end %>
<small>(Your vote: <span data-id="my-vote"><%= current_user.my_vote(@candidate) %></span>)</small> <small>(Your vote: <span data-id="my-vote"><%= current_user.my_vote(@candidate) %></span>)</small>
</div> </div>
<% end %> <% end %>

View File

@ -0,0 +1,6 @@
# frozen_string_literal: true
class RemoveVoteLocking < ActiveRecord::Migration[5.0]
def change
remove_column :reviewer_votes, :locked, :boolean, default: false, null: false
end
end

View File

@ -80,7 +80,6 @@ ActiveRecord::Schema.define(version: 20161120175737) do
t.integer "vote", default: 0, null: false t.integer "vote", default: 0, null: false
t.integer "veto", default: 0, null: false t.integer "veto", default: 0, null: false
t.datetime "last_reminded" t.datetime "last_reminded"
t.boolean "locked", default: false, null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["candidate_id", "user_id"], name: "index_reviewer_votes_on_candidate_id_and_user_id", unique: true, using: :btree t.index ["candidate_id", "user_id"], name: "index_reviewer_votes_on_candidate_id_and_user_id", unique: true, using: :btree