Skip to content

Commit

Permalink
Merge pull request #2223 from somiaj/hotfix-2216-2222
Browse files Browse the repository at this point in the history
Hotfix of #2216 and #2222
  • Loading branch information
drgrice1 authored Oct 23, 2023
2 parents f35316f + 3ba523e commit 5af82c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions htdocs/js/ProblemGrader/problemgrader.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,16 @@
} else {
// Update the hidden problem status fields and score table for gateway quizzes
if (saveData.versionId !== '0') {
document.gwquiz.elements['probstatus' + saveData.problemId].value =
parseInt(scoreInput.value) / 100;
const probStatus = document.gwquiz.elements[`probstatus${saveData.problemId}`];
if (probStatus) probStatus.value = parseInt(scoreInput.value) / 100;
let testValue = 0;
for (const scoreCell of document.querySelectorAll('table.gwNavigation td.score')) {
if (scoreCell.dataset.problemId == saveData.problemId) {
scoreCell.textContent = scoreInput.value == '100' ? '\u{1F4AF}' : scoreInput.value;
}
testValue += document.gwquiz.elements['probstatus'
+ scoreCell.dataset.problemId].value * scoreCell.dataset.problemValue;
testValue +=
(document.gwquiz.elements[`probstatus${scoreCell.dataset.problemId}`]?.value ?? 0) *
scoreCell.dataset.problemValue;
}
const recordedScore = document.getElementById('test-recorded-score');
if (recordedScore) {
Expand Down
6 changes: 4 additions & 2 deletions templates/ContentGenerator/GatewayQuiz.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@
% }
</div>
% # Store the problem status for continued attempts recording.
<%= hidden_field 'probstatus' . ($probOrder->[$i] + 1) => $c->{probStatus}[ $probOrder->[$i] ] =%>
<%= hidden_field 'probstatus' . $problems->[ $probOrder->[$i] ]{problem_id}
=> $c->{probStatus}[ $probOrder->[$i] ] =%>
%
<div class="gwDivider"></div>
% } else {
Expand All @@ -605,7 +606,8 @@
% }
% }
% # Store the problem status for continued attempts recording.
<%= hidden_field 'probstatus' . ($probOrder->[$i] + 1) => $c->{probStatus}[ $probOrder->[$i] ] %>
<%= hidden_field 'probstatus' . $problems->[ $probOrder->[$i] ]{problem_id}
=> $c->{probStatus}[ $probOrder->[$i] ] %>
% }
% }
%
Expand Down

0 comments on commit 5af82c6

Please sign in to comment.