Skip to content

Commit fc6be53

Browse files
Correctly display orphaned annotations on viewFeedback page (#1658)
* fixed issue where error occurred on viewFeedback if there's an orphaned problem * allow instructors/CA's to see annotations * updated getProblemNameWithId label to 'deleted problem(s)' for consistency, allow orphaned annotations to be deleted * put comment back Co-authored-by: Damian Ho <damian_ho_xu_yang@yahoo.com>
1 parent 2d4258b commit fc6be53

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

app/assets/javascripts/annotations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ var initializeAnnotationsForCode = function () {
429429
function getProblemNameWithId(problem_id) {
430430
var problem_id = parseInt(problem_id, 10);
431431
var problem = _.findWhere(problems, { "id": problem_id });
432-
if (problem == undefined) return "General";
432+
if (problem == undefined) return "Deleted Problem(s)";
433433
return problem.name;
434434
}
435435

app/models/annotation.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def update_non_autograded_score
3333
submission_id, problem_id
3434
)
3535

36+
# Associated problem was deleted
37+
return if score.problem_id && score.problem.nil?
38+
3639
# Ensure that problem is non-autograded
3740
return if score.grader_id == 0
3841

app/views/assessments/viewFeedback.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
</div>
1616
<pre><%= @score.feedback %></pre>
1717
</div>
18-
<% if @submission.annotations.count > 0 and @problemReleased %>
18+
<% if @submission.annotations.count > 0 and (@cud.instructor? or @cud.course_assistant? or @problemReleased) %>
1919
<div class="result-pane">
2020
<div class="feedback-header">
2121
<h2 style="margin-top: 1em">Remarks</h2>
2222
</div>
2323
<% subs_by_problem = @submission.annotations.group_by(&:problem)
2424
subs_by_problem.each do |problem, annotations| %>
25-
<b> <%= problem.name %> </b>
25+
<b> <%= problem.nil? ? "Deleted Problem(s)" : problem.name %> </b>
2626
<ul class="collection">
2727
<%# use custom sort b/c using ordering doesn't work with autograder output, archived files %>
2828
<%

0 commit comments

Comments
 (0)