Finish first regression test for participant response

This commit is contained in:
Andrea Fazzi 2020-03-03 16:51:53 +01:00
parent 6db487e37a
commit 587b35326b
5 changed files with 22 additions and 4 deletions

13
dist/main.bundle.js vendored

File diff suppressed because one or more lines are too long

View file

@ -243,6 +243,9 @@ func (model *Response) Update(db *Database, args map[string]string, w http.Respo
if !response.(*Response).IsActive() {
return nil, errors.OutOfTime
}
response.(*Response).SingleResponses = make([]*SingleResponse, 0)
err = renderer.Decode(response, r)
if err != nil {
return nil, err

View file

@ -66,4 +66,8 @@ $(function () {
$(".karmen-ajax-delete").on("click", deleteHandler);
$("#reset_responses").on("click", function(eventObject) {
$('.form-check-input').removeAttr('checked');
});
});

View file

@ -37,7 +37,7 @@
<footer class="footer text-center">
<div class="container">
<span class="text-center text-muted">© 2020 <a href="https://www.olimpiadi-economiaefinanza.it">Olimpiadi di Economia e Finanza 2020</a> ({{version}})
<span class="text-center text-muted">© 2020 <a href="https://www.olimpiadi-economiaefinanza.it">Olimpiadi di Economia e Finanza</a> ({{version}})
</span>
</div>
</footer>

View file

@ -46,7 +46,7 @@
{{if isResponseIn $answer.ID $.Data.AnswersIDs}}
{{$checked = true}}
{{end}}
<input class="form-check-input" type="radio" name="SingleResponses.{{$id}}" id="answer_{{$answer.ID}}" value="{{$answer.ID}}" required {{if $checked}}checked{{end}}>
<input class="form-check-input" type="radio" name="SingleResponses.{{$id}}" id="answer_{{$answer.ID}}" value="{{$answer.ID}}" {{if $isParticipant}}required{{end}} {{if $checked}}checked{{end}}>
<label class="form-check-label {{if and $isAdmin $answer.Correct}}text-success{{end}}" for="answer_{{$answer.ID}}">
{{$answer}}
</label>
@ -75,7 +75,7 @@
{{- end -}}
</dl>
<button type="submit" class="btn btn-primary" form="{{$form}}">Salva</button>
{{if $isAdmin}}<button id="reset_responses" type="reset" class="btn btn-outline-secondary" form="{{$form}}">Cancella risposte</button>{{end}}
{{if $isAdmin}}<button id="reset_responses" class="btn btn-outline-secondary">Cancella risposte</button>{{end}}
</div>
</div>
</div>