diff --git a/admin/api/exercice.go b/admin/api/exercice.go
index f82f562c..d4b7f36d 100644
--- a/admin/api/exercice.go
+++ b/admin/api/exercice.go
@@ -735,7 +735,8 @@ type uploadedFlag struct {
SortReGroups bool `json:"sort_re_grps"`
Flag string
Value []byte
- ChoicesCost int64 `json:"choices_cost"`
+ ChoicesCost int32 `json:"choices_cost"`
+ BonusGain int32 `json:"bonus_gain"`
}
func createExerciceFlag(c *gin.Context) {
@@ -758,7 +759,7 @@ func createExerciceFlag(c *gin.Context) {
exercice := c.MustGet("exercice").(*fic.Exercice)
- flag, err := exercice.AddRawFlagKey(uk.Label, uk.Type, uk.Placeholder, uk.IgnoreCase, uk.NoTrim, uk.Multiline, vre, uk.SortReGroups, []byte(uk.Flag), uk.ChoicesCost)
+ flag, err := exercice.AddRawFlagKey(uk.Label, uk.Type, uk.Placeholder, uk.IgnoreCase, uk.NoTrim, uk.Multiline, vre, uk.SortReGroups, []byte(uk.Flag), uk.ChoicesCost, uk.BonusGain)
if err != nil {
log.Println("Unable to createExerciceFlag:", err.Error())
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "An error occurs when trying to create flag."})
@@ -839,6 +840,7 @@ func updateExerciceFlag(c *gin.Context) {
flag.Checksum = uk.Value
}
flag.ChoicesCost = uk.ChoicesCost
+ flag.BonusGain = uk.BonusGain
if uk.ValidatorRe != nil && len(*uk.ValidatorRe) > 0 {
flag.ValidatorRegexp = uk.ValidatorRe
diff --git a/admin/static/views/exercice-flags.html b/admin/static/views/exercice-flags.html
index 9c052b4d..411d98d4 100644
--- a/admin/static/views/exercice-flags.html
+++ b/admin/static/views/exercice-flags.html
@@ -62,6 +62,9 @@
+
+
+
diff --git a/admin/static/views/team-score.html b/admin/static/views/team-score.html
index 8b151213..96ca8321 100644
--- a/admin/static/views/team-score.html
+++ b/admin/static/views/team-score.html
@@ -13,7 +13,7 @@
Date |
-
+
{{ exercice.title }}
|
diff --git a/admin/sync/exercice_defines.go b/admin/sync/exercice_defines.go
index 7dc3e2b4..ed926255 100644
--- a/admin/sync/exercice_defines.go
+++ b/admin/sync/exercice_defines.go
@@ -43,7 +43,8 @@ type ExerciceFlag struct {
SortReGroups bool `toml:"sort_validator_regexp_groups,omitempty"`
Placeholder string `toml:",omitempty"`
Help string `toml:",omitempty"`
- ChoicesCost int64 `toml:"choices_cost,omitempty"`
+ BonusGain int32 `toml:"bonus_gain,omitempty"`
+ ChoicesCost int32 `toml:"choices_cost,omitempty"`
Choice []ExerciceFlagChoice
LockedFile []ExerciceUnlockFile `toml:"unlock_file,omitempty"`
NeedFlag []ExerciceDependency `toml:"need_flag,omitempty"`
diff --git a/admin/sync/exercice_keys.go b/admin/sync/exercice_keys.go
index d8b9a4e6..be6ff83e 100644
--- a/admin/sync/exercice_keys.go
+++ b/admin/sync/exercice_keys.go
@@ -170,6 +170,7 @@ func buildKeyFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, defau
SortReGroups: flag.SortReGroups,
Checksum: hashedFlag[:],
ChoicesCost: flag.ChoicesCost,
+ BonusGain: flag.BonusGain,
})
f = &fl
diff --git a/backend/submission.go b/backend/submission.go
index 8ebdd4f9..b7268ca1 100644
--- a/backend/submission.go
+++ b/backend/submission.go
@@ -82,8 +82,7 @@ func treatSubmission(pathname string, team *fic.Team, exercice_id string) {
// Ensure the team didn't already solve this exercice
tm := team.HasSolved(exercice)
if tm != nil {
- log.Printf("%s [WRN] Team %d ALREADY solved exercice %d (%s : %s)\n", id, team.Id, exercice.Id, theme.Name, exercice.Title)
- return
+ log.Printf("%s [WRN] Team %d ALREADY solved exercice %d (%s : %s), continuing for eventual bonus flags\n", id, team.Id, exercice.Id, theme.Name, exercice.Title)
}
// Handle MCQ justifications: convert to expected keyid
@@ -119,7 +118,9 @@ func treatSubmission(pathname string, team *fic.Team, exercice_id string) {
log.Println(id, "[ERR] Can't remove file:", err)
}
- if solved {
+ if tm != nil {
+ genTeamQueue <- team
+ } else if solved {
log.Printf("%s Team %d SOLVED exercice %d (%s : %s)\n", id, team.Id, exercice.Id, theme.Name, exercice.Title)
if err := exercice.Solved(team); err != nil {
log.Println(id, "[ERR] Unable to mark the challenge as solved:", err)
diff --git a/frontend/ui/src/components/FlagKey.svelte b/frontend/ui/src/components/FlagKey.svelte
index cad9f925..a4a61875 100644
--- a/frontend/ui/src/components/FlagKey.svelte
+++ b/frontend/ui/src/components/FlagKey.svelte
@@ -100,6 +100,11 @@