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()
|
||||
uq.Subject = "RAS"
|
||||
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 {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "Subject not filled"})
|
||||
return
|
||||
|
@ -19,12 +19,19 @@
|
||||
function saveQuery() {
|
||||
newQuery.id_exercice = exercice.id;
|
||||
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) => {
|
||||
dispatch("new-query");
|
||||
newQuery = new QAQuery();
|
||||
creationInProgress = false;
|
||||
}).catch((err) => {
|
||||
creationInProgress = false;
|
||||
newQuery.content = myContent;
|
||||
ToastsStore.addErrorToast({
|
||||
msg: err,
|
||||
})
|
||||
@ -49,18 +56,47 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="subject" class="col-2 col-form-label col-form-label-sm">Sujet</label>
|
||||
<div class="col-10">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control form-control-sm"
|
||||
id="subject"
|
||||
placeholder="Le pcap ne contient pas l'IP attendue"
|
||||
bind:value={newQuery.subject}
|
||||
>
|
||||
{#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>
|
||||
<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">
|
||||
<label for="subject" class="col-2 col-form-label col-form-label-sm">Sujet</label>
|
||||
<div class="col-10">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control form-control-sm"
|
||||
id="subject"
|
||||
placeholder="Le pcap ne contient pas l'IP attendue"
|
||||
bind:value={newQuery.subject}
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="mb-3 row">
|
||||
<label for="description" class="col-2 col-form-label col-form-label-sm">Description</label>
|
||||
<div class="col-10">
|
||||
|
@ -1,5 +1,6 @@
|
||||
export const QAStates = {
|
||||
"ok": "OK",
|
||||
"timer": "Temps passé",
|
||||
"orthograph": "Orthographe et grammaire",
|
||||
"issue-statement": "Pas compris",
|
||||
"issue-flag": "Problème de flag",
|
||||
|
Loading…
x
Reference in New Issue
Block a user