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() { if !response.(*Response).IsActive() {
return nil, errors.OutOfTime return nil, errors.OutOfTime
} }
response.(*Response).SingleResponses = make([]*SingleResponse, 0)
err = renderer.Decode(response, r) err = renderer.Decode(response, r)
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -66,4 +66,8 @@ $(function () {
$(".karmen-ajax-delete").on("click", deleteHandler); $(".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"> <footer class="footer text-center">
<div class="container"> <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> </span>
</div> </div>
</footer> </footer>

View file

@ -46,7 +46,7 @@
{{if isResponseIn $answer.ID $.Data.AnswersIDs}} {{if isResponseIn $answer.ID $.Data.AnswersIDs}}
{{$checked = true}} {{$checked = true}}
{{end}} {{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}}"> <label class="form-check-label {{if and $isAdmin $answer.Correct}}text-success{{end}}" for="answer_{{$answer.ID}}">
{{$answer}} {{$answer}}
</label> </label>
@ -75,7 +75,7 @@
{{- end -}} {{- end -}}
</dl> </dl>
<button type="submit" class="btn btn-primary" form="{{$form}}">Salva</button> <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> </div>
</div> </div>