Skip to content

Commit

Permalink
Merge pull request #438 from NobodyNada/master
Browse files Browse the repository at this point in the history
Fix minor bug when viewing past reviews
  • Loading branch information
ArtOfCode- committed May 18, 2018
2 parents c294e2d + 68f3469 commit e7c08f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/controllers/review_queues_controller.rb
Expand Up @@ -28,8 +28,8 @@ def submit

@item = ReviewItem.find params[:item_id]

# Prevent the same item from being reviewed twice by the same user.
if (@item.completed && ReviewResult.exists?(item: @item)) ||
# Prevent the same item from being reviewed after it is completed, or twice by the same user.
if (@item.completed && ReviewResult.where(item: item).where.not(result: "skip").exists?) ||
ReviewResult.where(user: current_user, item: @item).where.not(result: 'skip').exists?

render json: { status: 'duplicate' }, status: 409
Expand Down
4 changes: 2 additions & 2 deletions app/views/review_queues/_responses.html.erb
@@ -1,6 +1,6 @@
<div class="panel panel-default">
<div class="panel-body">
<% if (item.completed and ReviewResult.exists?(item: item)) or
<% if (item.completed and ReviewResult.where(item: item).where.not(result: "skip").exists?) or
ReviewResult.where(user: current_user, item: item).where.not(result: "skip").exists? %>
<h5>
<% if item.completed %>
Expand Down Expand Up @@ -29,5 +29,5 @@
<%= link_to 'Skip', submit_review_path(name: queue.name, item_id: item.id, response: 'skip'), class: 'btn btn-primary review-submit-link',
method: :post, remote: true %>
<% end %>
</div>
</di
</div>

0 comments on commit e7c08f9

Please sign in to comment.