Split Unlock standalone exercices between themes and standalone ex
This commit is contained in:
parent
cc147a9819
commit
ae5068f8b8
@ -318,7 +318,8 @@ func ApplySettings(config *settings.Settings) {
|
|||||||
fic.DisplayAllFlags = config.DisplayAllFlags
|
fic.DisplayAllFlags = config.DisplayAllFlags
|
||||||
fic.HideCaseSensitivity = config.HideCaseSensitivity
|
fic.HideCaseSensitivity = config.HideCaseSensitivity
|
||||||
fic.UnlockedStandaloneExercices = config.UnlockedStandaloneExercices
|
fic.UnlockedStandaloneExercices = config.UnlockedStandaloneExercices
|
||||||
fic.UnlockedStandaloneExercicesByValidation = config.UnlockedStandaloneExercicesByValidation
|
fic.UnlockedStandaloneExercicesByThemeStepValidation = config.UnlockedStandaloneExercicesByThemeStepValidation
|
||||||
|
fic.UnlockedStandaloneExercicesByStandaloneExerciceValidation = config.UnlockedStandaloneExercicesByStandaloneExerciceValidation
|
||||||
fic.DisplayMCQBadCount = config.DisplayMCQBadCount
|
fic.DisplayMCQBadCount = config.DisplayMCQBadCount
|
||||||
fic.FirstBlood = config.FirstBlood
|
fic.FirstBlood = config.FirstBlood
|
||||||
fic.SubmissionCostBase = config.SubmissionCostBase
|
fic.SubmissionCostBase = config.SubmissionCostBase
|
||||||
|
@ -145,9 +145,16 @@
|
|||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="unlockedStandaloneExercicesByValidation" class="col-sm-auto col-form-label col-form-label-sm" ng-class="{'text-primary font-weight-bold': config.unlockedStandaloneExercicesByValidation != dist_config.unlockedStandaloneExercicesByValidation}">Exercices supplémentaires par validation</label>
|
<label for="unlockedStandaloneExercicesByThemeStepValidation" class="col-sm-auto col-form-label col-form-label-sm" ng-class="{'text-primary font-weight-bold': config.unlockedStandaloneExercicesByThemeStepValidation != dist_config.unlockedStandaloneExercicesByThemeStepValidation}">Débloqués par étape validée</label>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<input type="number" class="form-control form-control-sm" id="unlockedStandaloneExercicesByValidation" ng-model="config.unlockedStandaloneExercicesByValidation" ng-class="{'border-primary': config.unlockedStandaloneExercicesByValidation != dist_config.unlockedStandaloneExercicesByValidation}" min="0" step="0.01">
|
<input type="number" class="form-control form-control-sm" id="unlockedStandaloneExercicesByThemeStepValidation" ng-model="config.unlockedStandaloneExercicesByThemeStepValidation" ng-class="{'border-primary': config.unlockedStandaloneExercicesByThemeStepValidation != dist_config.unlockedStandaloneExercicesByThemeStepValidation}" min="0" step="0.01">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="unlockedStandaloneExercicesByStandaloneExerciceValidation" class="col-sm-auto col-form-label col-form-label-sm" ng-class="{'text-primary font-weight-bold': config.unlockedStandaloneExercicesByStandaloneExerciceValidation != dist_config.unlockedStandaloneExercicesByStandaloneExerciceValidation}">Débloqués par exercice indépendant validé</label>
|
||||||
|
<div class="col-sm">
|
||||||
|
<input type="number" class="form-control form-control-sm" id="unlockedStandaloneExercicesByStandaloneExerciceValidation" ng-model="config.unlockedStandaloneExercicesByStandaloneExerciceValidation" ng-class="{'border-primary': config.unlockedStandaloneExercicesByStandaloneExerciceValidation != dist_config.unlockedStandaloneExercicesByStandaloneExerciceValidation}" min="0" step="0.01">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -80,7 +80,8 @@ func reloadSettings(config *settings.Settings) {
|
|||||||
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
||||||
fic.UnlockedChallengeUpTo = config.UnlockedChallengeUpTo
|
fic.UnlockedChallengeUpTo = config.UnlockedChallengeUpTo
|
||||||
fic.UnlockedStandaloneExercices = config.UnlockedStandaloneExercices
|
fic.UnlockedStandaloneExercices = config.UnlockedStandaloneExercices
|
||||||
fic.UnlockedStandaloneExercicesByValidation = config.UnlockedStandaloneExercicesByValidation
|
fic.UnlockedStandaloneExercicesByThemeStepValidation = config.UnlockedStandaloneExercicesByThemeStepValidation
|
||||||
|
fic.UnlockedStandaloneExercicesByStandaloneExerciceValidation = config.UnlockedStandaloneExercicesByStandaloneExerciceValidation
|
||||||
fic.DisplayAllFlags = config.DisplayAllFlags
|
fic.DisplayAllFlags = config.DisplayAllFlags
|
||||||
|
|
||||||
fic.FirstBlood = config.FirstBlood
|
fic.FirstBlood = config.FirstBlood
|
||||||
|
@ -30,14 +30,15 @@ func reloadSettings(config *settings.Settings) {
|
|||||||
fic.WChoiceCoefficient = config.WChoiceCurCoefficient
|
fic.WChoiceCoefficient = config.WChoiceCurCoefficient
|
||||||
fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient
|
fic.ExerciceCurrentCoefficient = config.ExerciceCurCoefficient
|
||||||
ChStarted = config.Start.Unix() > 0 && time.Since(config.Start) >= 0
|
ChStarted = config.Start.Unix() > 0 && time.Since(config.Start) >= 0
|
||||||
if allowRegistration != config.AllowRegistration || fic.PartialValidation != config.PartialValidation || fic.UnlockedChallengeDepth != config.UnlockedChallengeDepth || fic.UnlockedStandaloneExercices != config.UnlockedStandaloneExercices || fic.UnlockedStandaloneExercicesByValidation != config.UnlockedStandaloneExercicesByValidation || fic.UnlockedChallengeUpTo != config.UnlockedChallengeUpTo || fic.DisplayAllFlags != config.DisplayAllFlags || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness || fic.DiscountedFactor != config.DiscountedFactor || fic.HideCaseSensitivity != config.HideCaseSensitivity {
|
if allowRegistration != config.AllowRegistration || fic.PartialValidation != config.PartialValidation || fic.UnlockedChallengeDepth != config.UnlockedChallengeDepth || fic.UnlockedStandaloneExercices != config.UnlockedStandaloneExercices || fic.UnlockedStandaloneExercicesByThemeStepValidation != config.UnlockedStandaloneExercicesByThemeStepValidation || fic.UnlockedStandaloneExercicesByStandaloneExerciceValidation != config.UnlockedStandaloneExercicesByStandaloneExerciceValidation || fic.UnlockedChallengeUpTo != config.UnlockedChallengeUpTo || fic.DisplayAllFlags != config.DisplayAllFlags || fic.FirstBlood != config.FirstBlood || fic.SubmissionCostBase != config.SubmissionCostBase || fic.SubmissionUniqueness != config.SubmissionUniqueness || fic.DiscountedFactor != config.DiscountedFactor || fic.HideCaseSensitivity != config.HideCaseSensitivity {
|
||||||
allowRegistration = config.AllowRegistration
|
allowRegistration = config.AllowRegistration
|
||||||
|
|
||||||
fic.PartialValidation = config.PartialValidation
|
fic.PartialValidation = config.PartialValidation
|
||||||
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
fic.UnlockedChallengeDepth = config.UnlockedChallengeDepth
|
||||||
fic.UnlockedChallengeUpTo = config.UnlockedChallengeUpTo
|
fic.UnlockedChallengeUpTo = config.UnlockedChallengeUpTo
|
||||||
fic.UnlockedStandaloneExercices = config.UnlockedStandaloneExercices
|
fic.UnlockedStandaloneExercices = config.UnlockedStandaloneExercices
|
||||||
fic.UnlockedStandaloneExercicesByValidation = config.UnlockedStandaloneExercicesByValidation
|
fic.UnlockedStandaloneExercicesByThemeStepValidation = config.UnlockedStandaloneExercicesByThemeStepValidation
|
||||||
|
fic.UnlockedStandaloneExercicesByStandaloneExerciceValidation = config.UnlockedStandaloneExercicesByStandaloneExerciceValidation
|
||||||
fic.DisplayAllFlags = config.DisplayAllFlags
|
fic.DisplayAllFlags = config.DisplayAllFlags
|
||||||
|
|
||||||
fic.FirstBlood = config.FirstBlood
|
fic.FirstBlood = config.FirstBlood
|
||||||
|
@ -127,12 +127,12 @@ func (t *Team) HasAccess(e *Exercice) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
sc, err := t.SolvedCount()
|
nbsteps, nbexos, err := t.SolvedCount()
|
||||||
if sc == nil || err != nil {
|
if nbsteps == nil || nbexos == nil || err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if ord < UnlockedStandaloneExercices+int(UnlockedStandaloneExercicesByValidation*float64(*sc)) {
|
if ord < UnlockedStandaloneExercices+int(math.Floor(UnlockedStandaloneExercicesByThemeStepValidation*float64(*nbsteps)))+int(math.Floor(UnlockedStandaloneExercicesByStandaloneExerciceValidation*float64(*nbexos))) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,8 +321,13 @@ func (t *Team) LastTryDist(e *Exercice) int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SolvedCount returns the number of solved exercices.
|
// SolvedCount returns the number of solved exercices.
|
||||||
func (t *Team) SolvedCount() (nb *int64, err error) {
|
func (t *Team) SolvedCount() (nbsteps *int64, nbex *int64, err error) {
|
||||||
err = DBQueryRow("SELECT COUNT(*) FROM exercice_solved WHERE id_team = ?", t.Id).Scan(&nb)
|
err = DBQueryRow("SELECT COUNT(S.id_exercice) FROM exercice_solved S INNER JOIN exercices E ON E.id_exercice = S.id_exercice WHERE S.id_team = ? AND E.id_theme IS NOT NULL", t.Id).Scan(&nbsteps)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = DBQueryRow("SELECT COUNT(S.id_exercice) FROM exercice_solved S INNER JOIN exercices E ON E.id_exercice = S.id_exercice WHERE S.id_team = ? AND E.id_theme IS NULL", t.Id).Scan(&nbex)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,11 @@ var HideCaseSensitivity bool
|
|||||||
// UnlockedStandaloneExercices unlock this number of standalone exercice.
|
// UnlockedStandaloneExercices unlock this number of standalone exercice.
|
||||||
var UnlockedStandaloneExercices int
|
var UnlockedStandaloneExercices int
|
||||||
|
|
||||||
// UnlockedStandaloneExercicesByValidation unlock this number of standalone exercice for each exercice validated.
|
// UnlockedStandaloneExercicesByThemeStepValidation unlock this number of standalone exercice for each theme step validated.
|
||||||
var UnlockedStandaloneExercicesByValidation float64
|
var UnlockedStandaloneExercicesByThemeStepValidation float64
|
||||||
|
|
||||||
|
// UnlockedStandaloneExercicesByStandaloneExerciceValidation unlock this number of standalone exercice for each standalone exercice validated.
|
||||||
|
var UnlockedStandaloneExercicesByStandaloneExerciceValidation float64
|
||||||
|
|
||||||
type myTeamFile struct {
|
type myTeamFile struct {
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
|
@ -73,8 +73,10 @@ type Settings struct {
|
|||||||
UnlockedChallengeUpTo int `json:"unlockedChallengeUpTo"`
|
UnlockedChallengeUpTo int `json:"unlockedChallengeUpTo"`
|
||||||
// UnlockedStandaloneExercices unlock this number of standalone exercice.
|
// UnlockedStandaloneExercices unlock this number of standalone exercice.
|
||||||
UnlockedStandaloneExercices int `json:"unlockedStandaloneExercices,omitempty"`
|
UnlockedStandaloneExercices int `json:"unlockedStandaloneExercices,omitempty"`
|
||||||
// UnlockedStandaloneExercicesByValidation unlock this number of standalone exercice for each exercice validated.
|
// UnlockedStandaloneExercicesByThemeStepValidation unlock this number of standalone exercice for each theme step validated.
|
||||||
UnlockedStandaloneExercicesByValidation float64 `json:"unlockedStandaloneExercicesByValidation,omitempty"`
|
UnlockedStandaloneExercicesByThemeStepValidation float64 `json:"unlockedStandaloneExercicesByThemeStepValidation,omitempty"`
|
||||||
|
// UnlockedStandaloneExercicesByStandaloneExerciceValidation unlock this number of standalone exercice for each standalone exercice validated.
|
||||||
|
UnlockedStandaloneExercicesByStandaloneExerciceValidation float64 `json:"unlockedStandaloneExercicesByStandaloneExerciceValidation,omitempty"`
|
||||||
// SubmissionUniqueness don't count multiple times identical tries.
|
// SubmissionUniqueness don't count multiple times identical tries.
|
||||||
SubmissionUniqueness bool `json:"submissionUniqueness,omitempty"`
|
SubmissionUniqueness bool `json:"submissionUniqueness,omitempty"`
|
||||||
// CountOnlyNotGoodTries don't count as a try when one good response is given at least.
|
// CountOnlyNotGoodTries don't count as a try when one good response is given at least.
|
||||||
|
Loading…
Reference in New Issue
Block a user