ui: fix objective radiobox loadAns (#792)

This commit is contained in:
panda authored and GitHub committed 2024-04-25 17:50:25 +08:00
1 parent f04b55d69b
commit 45600eafcb
1 file changed
+4 -2
@@ -254,11 +254,13 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
for (const [id, val] of Object.entries(ans)) {
if (Array.isArray(val)) {
for (const v of val) {
$(`.objective_${id} input[value=${v}]`).prop('checked', true);
if (val.length === 1
&& val.charCodeAt(0) >= 65 && val.charCodeAt(0) <= 90) $(`.objective_${id} input[value=${v}]`).prop('checked', true);
}
}
$(`.objective_${id} input[type=text], .objective_${id} textarea`).val(val);
$(`.objective_${id}.radiobox [value="${val}"]`).prop('checked', true);
if (val.length === 1
&& val.charCodeAt(0) >= 65 && val.charCodeAt(0) <= 90) $(`.objective_${id}.radiobox [value="${val}"]`).prop('checked', true);
}
}
}