settings: add new coefficient for all exercices
This commit is contained in:
parent
42e6a4d386
commit
4a4d0f634a
@ -60,15 +60,21 @@
|
||||
<hr>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="hintcoefficient" class="col-sm-3 col-form-label col-form-label-sm">Coefficient indices</label>
|
||||
<div class="col-sm-2">
|
||||
<label for="exercicecurcoefficient" class="col-sm-3 col-form-label col-form-label-sm"><strong>Coefficients</strong></label>
|
||||
<label for="hintcoefficient" class="col-sm-2 col-form-label col-form-label-sm text-right">incides</label>
|
||||
<div class="col-sm-1">
|
||||
<input type="text" class="form-control form-control-sm" id="hintcoefficient" ng-model="config.hintCurrentCoefficient" float>
|
||||
</div>
|
||||
|
||||
<label for="wchoicescoefficient" class="offset-sm-2 col-sm-3 col-form-label col-form-label-sm">Coefficient WChoices</label>
|
||||
<div class="col-sm-2">
|
||||
<label for="wchoicescoefficient" class="col-sm-2 col-form-label col-form-label-sm text-right">WChoices</label>
|
||||
<div class="col-sm-1">
|
||||
<input type="text" class="form-control form-control-sm" id="wchoicescoefficient" ng-model="config.wchoiceCurrentCoefficient" float>
|
||||
</div>
|
||||
|
||||
<label for="exercicecurcoefficient" class="col-sm-2 col-form-label col-form-label-sm text-right">défis</label>
|
||||
<div class="col-sm-1">
|
||||
<input type="text" class="form-control form-control-sm" id="exercicecurcoefficient" ng-model="config.exerciceCurrentCoefficient" float>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
@ -76,7 +82,7 @@
|
||||
<div class="col-sm-2">
|
||||
<input type="text" class="form-control form-control-sm" id="firstBlood" ng-model="config.firstBlood" float>
|
||||
</div>
|
||||
<label for="submissionCostBase" class="offset-sm-1 col-sm-4 col-form-label col-form-label-sm">Coût de base d'une tentative</label>
|
||||
<label for="submissionCostBase" class="offset-sm-1 col-sm-4 col-form-label col-form-label-sm text-right">Coût de base d'une tentative</label>
|
||||
<div class="col-sm-2">
|
||||
<input type="text" class="form-control form-control-sm" id="submissionCostBase" ng-model="config.submissionCostBase" float>
|
||||
</div>
|
||||
|
@ -49,6 +49,7 @@ var skipInitialGeneration = false
|
||||
func reloadSettings(config settings.FICSettings) {
|
||||
fic.HintCoefficient = config.HintCurCoefficient
|
||||
fic.WChoiceCoefficient = config.WChoiceCurCoefficient
|
||||
fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient
|
||||
if lastRegeneration != config.Generation || fic.PartialValidation != config.PartialValidation || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness {
|
||||
fic.PartialValidation = config.PartialValidation
|
||||
if config.EnableExerciceDepend {
|
||||
|
@ -30,7 +30,7 @@
|
||||
<div class="alert alert-{{my.exercices[current_exercice].issuekind}}" ng-if="my.exercices[current_exercice].issue" ng-bind-html="my.exercices[current_exercice].issue"></div>
|
||||
<hr class="my-3">
|
||||
<ul>
|
||||
<li><strong>Gain :</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].gain" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize> <em ng-if="settings.firstBlood && themes[current_theme].exercices[current_exercice].solved < 1">{{ 1 + settings.firstBlood | coeff }} prem's</em> <em ng-if="themes[current_theme].exercices[current_exercice].curcoeff != 1.0">{{ themes[current_theme].exercices[current_exercice].curcoeff | coeff }} bonus</em></li>
|
||||
<li><strong>Gain :</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].gain" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize> <em ng-if="settings.firstBlood && themes[current_theme].exercices[current_exercice].solved < 1">{{ 1 + settings.firstBlood | coeff }} prem's</em> <em ng-if="themes[current_theme].exercices[current_exercice].curcoeff != 1.0 || settings.exerciceCurrentCoefficient">{{ themes[current_theme].exercices[current_exercice].curcoeff * settings.exerciceCurrentCoefficient | coeff }} bonus</em></li>
|
||||
<li><strong>Résolu par :</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].solved" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize>.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -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
|
||||
|
@ -42,6 +42,8 @@ type FICSettings struct {
|
||||
FirstBlood float64 `json:"firstBlood"`
|
||||
// SubmissionCostBase is a complex number representing the cost of each attempts.
|
||||
SubmissionCostBase float64 `json:"submissionCostBase"`
|
||||
// ExerciceCurrentCoefficient is the current coefficient applied globaly to exercices.
|
||||
ExerciceCurCoefficient float64 `json:"exerciceCurrentCoefficient"`
|
||||
// HintCurrentCoefficient is the current coefficient applied to hint discovery.
|
||||
HintCurCoefficient float64 `json:"hintCurrentCoefficient"`
|
||||
// WChoiceCurCoefficient is the current coefficient applied to wanted choices.
|
||||
|
Loading…
Reference in New Issue
Block a user