settings: add new coefficient for all exercices
This commit is contained in:
parent
42e6a4d386
commit
4a4d0f634a
5 changed files with 19 additions and 7 deletions
|
|
@ -15,6 +15,9 @@ var PartialValidation bool
|
|||
// Otherwise, all MCQ has to be correct for being validated.
|
||||
var PartialMCQValidation bool
|
||||
|
||||
// ExerciceCurrentCoefficient is the current coefficient applied on solved exercices
|
||||
var ExerciceCurrentCoefficient = 1.0
|
||||
|
||||
// Exercice represents a challenge inside a Theme.
|
||||
type Exercice struct {
|
||||
Id int64 `json:"id"`
|
||||
|
|
@ -310,7 +313,7 @@ func (e Exercice) UpdateTry(t Team, nbdiff int) error {
|
|||
|
||||
// Solved registers that the given Team solves the challenge.
|
||||
func (e Exercice) Solved(t Team) error {
|
||||
if _, err := DBExec("INSERT INTO exercice_solved (id_exercice, id_team, time, coefficient) VALUES (?, ?, ?, ?)", e.Id, t.Id, time.Now(), e.Coefficient); err != nil {
|
||||
if _, err := DBExec("INSERT INTO exercice_solved (id_exercice, id_team, time, coefficient) VALUES (?, ?, ?, ?)", e.Id, t.Id, time.Now(), e.Coefficient * ExerciceCurrentCoefficient); err != nil {
|
||||
return err
|
||||
} else {
|
||||
return nil
|
||||
|
|
|
|||
Reference in a new issue