backend: Can lock submission for a given exercice

This commit is contained in:
nemunaire 2023-04-06 15:27:10 +02:00
commit 268925db0d
3 changed files with 112 additions and 0 deletions

View file

@ -237,6 +237,8 @@ func treat(raw_path string) {
treatOpeningHint(raw_path, team)
case "choices":
treatWantChoices(raw_path, team)
case ".locked":
treatLocked(raw_path, team)
default:
treatSubmission(raw_path, team, spath[2])
}

View file

@ -37,6 +37,14 @@ func treatSubmission(pathname string, team *fic.Team, exercice_id string) {
return
}
// Identifier should not be blacklisted for the team
if blacklistteam, ok := TeamLockedExercices[team.Id]; ok {
if locked, ok := blacklistteam[exercice_id]; ok && locked {
log.Printf("%s [!!!] Submission received for team's locked exercice %d\n", id, eid)
return
}
}
// Find the given exercice
exercice, err := fic.GetExercice(eid)
if err != nil {