add column full_score_reached, fill it accordingly and show information in the rfc index

This commit is contained in:
Ralf Teusner
2018-01-31 11:23:30 +01:00
parent e934a29a45
commit efc271c4ed
6 changed files with 37 additions and 10 deletions

View File

@ -47,6 +47,14 @@ module SubmissionScoring
end
end
submission.update(score: score)
if submission.normalized_score == 1.0
Thread.new do
RequestForComment.where(exercise_id: submission.exercise_id, user_id: submission.user_id, user_type: submission.user_type).each{ |rfc|
rfc.full_score_reached = true
rfc.save
}
end
end
outputs
end
end

View File

@ -20,7 +20,7 @@ class RequestForCommentsController < ApplicationController
.group('request_for_comments.id, request_for_comments.user_id, request_for_comments.exercise_id,
request_for_comments.file_id, request_for_comments.question, request_for_comments.created_at,
request_for_comments.updated_at, request_for_comments.user_type, request_for_comments.solved,
request_for_comments.submission_id, request_for_comments.row_number') # ugly, but rails wants it this way
request_for_comments.full_score_reached, request_for_comments.submission_id, request_for_comments.row_number') # ugly, but rails wants it this way
.select('request_for_comments.*, max(comments.updated_at) as last_comment')
.search(params[:q])
@request_for_comments = @search.result.order('created_at DESC').paginate(page: params[:page], total_entries: @search.result.length)