fic: fix exercice indicated as solved

This commit is contained in:
nemunaire 2018-12-04 22:25:38 +01:00
parent 4f088d1cdb
commit c05609f85f

View File

@ -117,9 +117,9 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
} else { } else {
solved, stime := t.HasSolved(e) solved, stime := t.HasSolved(e)
exercice.SolvedTime = &stime exercice.SolvedTime = &stime
exercice.SolvedRank, _ = t.GetSolvedRank(e)
if solved { if solved {
exercice.SolvedRank, _ = t.GetSolvedRank(e)
exercice.Finished = e.Finished exercice.Finished = e.Finished
exercice.Tries, _ = t.CountTries(e) exercice.Tries, _ = t.CountTries(e)
} else { } else {
@ -130,6 +130,10 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
} }
} }
if exercice.SolvedTime != nil && exercice.SolvedTime.Equal(time.Unix(0, 0)) {
exercice.SolvedTime = nil
}
if gain, err := e.EstimateGain(*t, solved); err == nil { if gain, err := e.EstimateGain(*t, solved); err == nil {
exercice.Gain = int(gain) exercice.Gain = int(gain)
} else { } else {