Display mcq and ucq corrections
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
nemunaire 2022-09-01 22:09:14 +02:00
parent 8acdf30ba4
commit e0cd502c35
4 changed files with 54 additions and 14 deletions

View file

@ -14,6 +14,7 @@
export let qid;
export let response_history = null;
export let readonly = false;
export let corrections = {};
export let survey = null;
export let value = "";
@ -92,6 +93,7 @@
{proposals}
readonly
live={survey.direct !== null}
{corrections}
bind:value={value}
on:change={() => { dispatch("change"); }}
/>
@ -110,6 +112,7 @@
{proposals}
{readonly}
live={survey.direct !== null}
{corrections}
bind:value={value}
on:change={() => { dispatch("change"); }}
/>

View file

@ -9,6 +9,7 @@
export let kind = 'mcq';
export let prefixid = '';
export let readonly = false;
export let corrections = {};
export let id_question = 0;
export let value;
@ -91,8 +92,11 @@
class:form-check-label={!live}
class:btn={live}
class:btn-lg={live}
class:btn-primary={live && value.indexOf(proposal.id.toString()) != -1}
class:btn-outline-primary={live && value.indexOf(proposal.id.toString()) == -1}
class:btn-primary={live && !corrections && value.indexOf(proposal.id.toString()) != -1}
class:btn-outline-primary={live && !corrections && value.indexOf(proposal.id.toString()) == -1}
class:btn-success={live && corrections && corrections[proposal.id] == 0}
class:btn-outline-warning={live && corrections && corrections[proposal.id] != 0 && corrections[proposal.id] != -100}
class:btn-outline-danger={live && corrections && corrections[proposal.id] == -100}
for={prefixid + 'p' + proposal.id}
>
{proposal.label}

View file

@ -90,6 +90,7 @@
if (data.action && data.action == "new_question") {
show_question = data.question;
survey.corrected = data.corrected;
corrections = data.corrections;
if (timer_cancel) {
clearInterval(timer_cancel);
timer_cancel = null;
@ -156,6 +157,8 @@
});
});
}
let corrections = {};
</script>
{#await surveyP then unused}
@ -189,6 +192,7 @@
{survey}
{question}
readonly={timer >= 100 || survey.corrected}
{corrections}
bind:value={value}
on:change={sendValue}
>