qa: Add a new field to retrieve passed time on exercice
This commit is contained in:
parent
3a38a75e25
commit
31bccddc49
@ -109,6 +109,10 @@ func createExerciceQA(c *gin.Context) {
|
|||||||
tmp := time.Now()
|
tmp := time.Now()
|
||||||
uq.Subject = "RAS"
|
uq.Subject = "RAS"
|
||||||
uq.Solved = &tmp
|
uq.Solved = &tmp
|
||||||
|
} else if uq.State == "timer" {
|
||||||
|
tmp := time.Now()
|
||||||
|
uq.Subject = fmt.Sprintf("Temps passé équipe #%d (%s)", teamid, ficteam)
|
||||||
|
uq.Solved = &tmp
|
||||||
} else {
|
} else {
|
||||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "Subject not filled"})
|
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "Subject not filled"})
|
||||||
return
|
return
|
||||||
|
@ -19,12 +19,19 @@
|
|||||||
function saveQuery() {
|
function saveQuery() {
|
||||||
newQuery.id_exercice = exercice.id;
|
newQuery.id_exercice = exercice.id;
|
||||||
creationInProgress = true;
|
creationInProgress = true;
|
||||||
|
const myContent = newQuery.content;
|
||||||
|
if (!newQuery.content) newQuery.content = "";
|
||||||
|
if (newQuery.difficulty)
|
||||||
|
newQuery.content = "Difficulté : " + newQuery.difficulty + "\n" + newQuery.content;
|
||||||
|
if (newQuery.timecount)
|
||||||
|
newQuery.content = "Temps passé : " + newQuery.timecount + "\n" + newQuery.content;
|
||||||
newQuery.save().then((res) => {
|
newQuery.save().then((res) => {
|
||||||
dispatch("new-query");
|
dispatch("new-query");
|
||||||
newQuery = new QAQuery();
|
newQuery = new QAQuery();
|
||||||
creationInProgress = false;
|
creationInProgress = false;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
creationInProgress = false;
|
creationInProgress = false;
|
||||||
|
newQuery.content = myContent;
|
||||||
ToastsStore.addErrorToast({
|
ToastsStore.addErrorToast({
|
||||||
msg: err,
|
msg: err,
|
||||||
})
|
})
|
||||||
@ -49,6 +56,34 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{#if newQuery.state == "timer"}
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label for="time-count" class="col-2 col-form-label col-form-label-sm">En combien de temps avez-vous résolu cet exercice ?</label>
|
||||||
|
<div class="col-10">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="form-control form-control-sm"
|
||||||
|
id="time-count"
|
||||||
|
placeholder="10 minutes"
|
||||||
|
bind:value={newQuery.timecount}
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label for="difficulty" class="col-2 col-form-label col-form-label-sm">Comment jaugez-vous la difficulté de cet exercice ?</label>
|
||||||
|
<div class="col-10">
|
||||||
|
<select class="form-select form-select-sm" id="difficulty" bind:value={newQuery.difficulty}>
|
||||||
|
<option value="trop facile">Trop facile</option>
|
||||||
|
<option value="facile">Facile</option>
|
||||||
|
<option value="moyen">Moyen</option>
|
||||||
|
<option value="difficile">Difficile</option>
|
||||||
|
<option value="très difficile">Très difficile</option>
|
||||||
|
<option value="trop difficile">Trop difficile</option>
|
||||||
|
<option value="insane">Insane</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<label for="subject" class="col-2 col-form-label col-form-label-sm">Sujet</label>
|
<label for="subject" class="col-2 col-form-label col-form-label-sm">Sujet</label>
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
@ -61,6 +96,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<label for="description" class="col-2 col-form-label col-form-label-sm">Description</label>
|
<label for="description" class="col-2 col-form-label col-form-label-sm">Description</label>
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
export const QAStates = {
|
export const QAStates = {
|
||||||
"ok": "OK",
|
"ok": "OK",
|
||||||
|
"timer": "Temps passé",
|
||||||
"orthograph": "Orthographe et grammaire",
|
"orthograph": "Orthographe et grammaire",
|
||||||
"issue-statement": "Pas compris",
|
"issue-statement": "Pas compris",
|
||||||
"issue-flag": "Problème de flag",
|
"issue-flag": "Problème de flag",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user