Skip to content

Commit

Permalink
Merge a5b3c32 into 28eb0da
Browse files Browse the repository at this point in the history
  • Loading branch information
buhubu committed Nov 21, 2019
2 parents 28eb0da + a5b3c32 commit 99b2530
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/models/on_the_fly_calc.rb
Expand Up @@ -78,6 +78,7 @@ def scores_varying_rubrics
reviewer = {} if reviewer.nil?
reviewer[round] = {} if reviewer[round].nil?
reviewer[round] = @respective_scores
@review_scores[response_map.reviewer_id] = reviewer
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/review_response_map.rb
Expand Up @@ -153,7 +153,7 @@ def self.prepare_review_response(assignment, maps, review_final_versions, round)
symbol = if round.nil?
:review
else
("review round" + round.to_s).to_sym
("review round" + " " + round.to_s).to_sym
end
review_final_versions[symbol] = {}
review_final_versions[symbol][:questionnaire_id] = assignment.review_questionnaire_id(round)
Expand Down
3 changes: 2 additions & 1 deletion app/views/grades/view_team.html.erb
Expand Up @@ -134,7 +134,8 @@

<!-- actual cells with scores and colored background. -->
<% row.score_row.each do |score| %>
<td class="<%= score.color_code %>" align="center" data-toggle="tooltip" title="<%= strip_tags(score.comment).html_safe%>">
<% score_comment = score.comment.nil? ? '' : score.comment %> <!-- changing nil to null string to avoid Null Pointer Exception -->
<td class="<%= score.color_code %>" align="center" data-toggle="tooltip" title="<%= strip_tags(score_comment).html_safe%>">
<span class="<%= underlined?(score) %>"><%= score.score_value.to_s %></span>
</td>
<% end %>
Expand Down
3 changes: 2 additions & 1 deletion app/views/reports/_review_report.html.erb
Expand Up @@ -45,13 +45,14 @@
</thead>
<tbody>

<% sort_reviewer_by_review_volume_desc.each do |r| %>
<% sort_reviewer_by_review_volume_desc.each_with_index do |r, index| %>
<% @response_maps, @rspan = get_data_for_review_report(@id, r.id, @type) %>
<tr>
<% if r.id != -1 %>
<% user = Participant.find(r.id).user %>
<!--reviewer-->
<td>
<%= index + 1 %>.
<%= link_to user.name(session[:ip]), impersonate_impersonate_path(:user => {:name => user.name(session[:ip])}), :method => :post %>
(<%= user.fullname(session[:ip]) %>)
</td>
Expand Down
2 changes: 1 addition & 1 deletion spec/models/on_the_fly_calc_spec.rb
Expand Up @@ -37,7 +37,7 @@
it 'scores varying rubrics and returns review scores' do
allow(assignment).to receive(:varying_rubrics_by_round?).and_return(true)
allow(assignment).to receive(:rounds_of_reviews).and_return(1)
expect(assignment.compute_reviews_hash).to eql({})
expect(assignment.compute_reviews_hash).to eql({1=>{1=>{1=>50}}, 2=>{1=>{1=>30}}})
end
end
context 'when current assignment does not vary rubrics by round' do
Expand Down
4 changes: 2 additions & 2 deletions spec/models/review_response_map_spec.rb
Expand Up @@ -135,7 +135,7 @@
allow(Response).to receive(:where).with(map_id: 1, round: 2).and_return([response1])
allow(assignment).to receive(:review_questionnaire_id).with(2).and_return(1)
expect(ReviewResponseMap.final_versions_from_reviewer(1))
.to eq("review round1": {questionnaire_id: 1, response_ids: [1]}, "review round2": {questionnaire_id: 1, response_ids: [2]})
.to eq("review round 1": {questionnaire_id: 1, response_ids: [1]}, "review round 2": {questionnaire_id: 1, response_ids: [2]})
end

it '#review_response_report' do
Expand Down Expand Up @@ -184,7 +184,7 @@
current_assignment = Assignment.find(Participant.find(reviewer_id).parent_id)
meta_review_response_maps = MetareviewResponseMap.where(reviewed_object_id: 1)
expect(ReviewResponseMap.prepare_final_review_versions(current_assignment, meta_review_response_maps))
.to eq("review round1": {questionnaire_id: 1, response_ids: [1]}, "review round2": {questionnaire_id: 1, response_ids: [2]})
.to eq("review round 1": {questionnaire_id: 1, response_ids: [1]}, "review round 2": {questionnaire_id: 1, response_ids: [2]})
# when round = nil
reviewer_id = 2
allow(Participant).to receive(:find).with(2).and_return(participant1)
Expand Down

0 comments on commit 99b2530

Please sign in to comment.