Skip to content

Commit 487e46e

Browse files
committed
Improvements for the problem renderer on the problem grader page.
First, this makes it so that feedback is shown on initial render. This occurs both on initial page load (for the initially selected user), and also occurs when a different user is selected from the dropdown. Second, this fixes some issues with tests and answers. The test answer prefix needs to be preserved in the form so that checking answers works. Also, the `ProblemGrader.html.ep` template was constructing the quiz prefix from the problem number and should be using the `problem_id` (which is what the GatewayQuiz.pm module uses). That means the last answers were not working at all for tests with random problem order.
1 parent 2368f3e commit 487e46e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

htdocs/js/ProblemGrader/problemgrader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
problemSeed: selectedUser.dataset.problemSeed,
1616
set_id: document.getElementsByName('hidden_set_id')[0]?.value,
1717
probNum: document.getElementsByName('hidden_problem_id')[0]?.value,
18-
processAnswers: 1
18+
processAnswers: 1,
19+
WWcorrectAns: 1
1920
};
2021

2122
if (selectedUser.dataset.versionId) ro.version_id = selectedUser.dataset.versionId;

templates/ContentGenerator/Instructor/ProblemGrader.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
ref($_->{problem}) =~ /::ProblemVersion/
7878
? (
7979
version_id => $_->{problem}->version_id,
80-
answer_prefix => sprintf('Q%04d_', $_->{problemNumber} + 1)
80+
answer_prefix => sprintf('Q%04d_', $_->{problem}->problem_id)
8181
)
8282
: (),
8383
}

templates/RPCRenderFormats/default.html.ep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
%= hidden_field showFooter => $showFooter
103103
%= hidden_field extra_header_text => $extra_header_text
104104
%= hidden_field problem_data => $problem_data
105+
% if ($ws->{inputs_ref}{answerPrefix}) {
106+
%= hidden_field answerPrefix => $ws->{inputs_ref}{answerPrefix}
107+
% }
105108
% if ($formatName eq 'debug' && $ws->{inputs_ref}{clientDebug}) {
106109
%= hidden_field clientDebug => $ws->{inputs_ref}{clientDebug}
107110
% }

0 commit comments

Comments
 (0)