Skip to content

Commit

Permalink
Added link for score details and regrade flash error
Browse files Browse the repository at this point in the history
  • Loading branch information
KesterTan committed Feb 18, 2025
1 parent 320631b commit 88c40e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 9 additions & 4 deletions app/assets/javascripts/manage_submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,15 @@ $(document).ready(function() {
${submission.total}
</td>
${submission.problems.
map((problem) =>
`<td class="submissions-td">${data.scores[submission.id]?.[problem.id]?.['score'] ?? "-"}</td>`
).join('')}
map((problem) =>
`<td class="submissions-td">
${data.scores[submission.id]?.[problem.id]?.['score'] !== undefined
? `<a href="viewFeedback?submission_id=${submission.id}&feedback=${problem.id}">
${data.scores[submission.id][problem.id]['score'].toFixed(1)}
</a>`
: "-"}
</td>`
).join('')}
<td class="submissions-td">
${submission.late_penalty}
</td>
Expand Down Expand Up @@ -280,7 +286,6 @@ $(document).ready(function() {
changeButtonStates(!selectedSubmissions.length); // update button states
}


// SELECTED BUTTONS

// create selected buttons inside datatable wrapper
Expand Down
9 changes: 7 additions & 2 deletions app/controllers/assessment/autograde.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def regradeBatch

# Now regrade only the most recent submissions. Keep track of
# any handins that fail.
submissions = submission_ids.map {|sid| @assessment.submissions.find_by_id(sid)}
submissions = submission_ids.filter_map do |sid|
_is_i?(sid) ? @assessment.submissions.find_by_id(sid) : nil
end

begin
failed_list = sendJob_batch(@course, @assessment, submissions, @cud)
Expand All @@ -114,7 +116,7 @@ def regradeBatch
end
end

success_jobs = submission_ids.size - failure_jobs
success_jobs = submissions.size - failure_jobs
if success_jobs > 0
link = "<a href=\"#{url_for(controller: 'jobs')}\">#{ActionController::Base.helpers.pluralize(success_jobs, "submission")}</a>"
flash[:success] = ("Regrading #{link}")
Expand Down Expand Up @@ -230,4 +232,7 @@ def sendJob_AddHTMLMessages(course, assessment, submissions)
job
end

def _is_i?(string)
!!(string =~ /\A[-+]?[0-9]+\z/)
end
end

0 comments on commit 88c40e4

Please sign in to comment.