Skip to content

Commit ea17699

Browse files
committed
api-wording - Add a fix for iss1459 (correct answers in wrong order).
1 parent ab919a6 commit ea17699

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

api/public/stackshared.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ function send() {
9292
const inputs = json.questioninputs;
9393
let correctAnswers = '';
9494
// Show correct answers.
95-
for (const [name, input] of Object.entries(inputs)) {
95+
const placeholders = question.matchAll(/\[\[input:([a-zA-Z][a-zA-Z0-9_]*)\]\]/g);
96+
for (const holder of placeholders) {
97+
const name = holder[1];
98+
const input = inputs[name];
9699
question = question.replace(`[[input:${name}]]`, input.render);
97100
question = question.replace(`[[validation:${name}]]`, `<span name='${validationPrefix + name}'></span>`);
98101
if (input.samplesolutionrender && name !== 'remember') {

0 commit comments

Comments
 (0)