backend: new option that unlock all challenges
This commit is contained in:
parent
bfaf8c8305
commit
0e5222e5cc
@ -47,6 +47,7 @@ func main() {
|
|||||||
flag.StringVar(&TeamsDir, "teams", "../TEAMS", "Base directory where save teams JSON files")
|
flag.StringVar(&TeamsDir, "teams", "../TEAMS", "Base directory where save teams JSON files")
|
||||||
flag.StringVar(&fic.FilesDir, "files", "/files", "Request path prefix to reach files")
|
flag.StringVar(&fic.FilesDir, "files", "/files", "Request path prefix to reach files")
|
||||||
var skipFullGeneration = flag.Bool("skipFullGeneration", false, "Skip initial full generation (safe to skip after start)")
|
var skipFullGeneration = flag.Bool("skipFullGeneration", false, "Skip initial full generation (safe to skip after start)")
|
||||||
|
flag.BoolVar(&fic.UnlockedChallenges, "unlockedChallenges", false, "Make all challenges accessible without having to validate previous level")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
log.SetPrefix("[backend] ")
|
log.SetPrefix("[backend] ")
|
||||||
|
@ -6,6 +6,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var UnlockedChallenges bool
|
||||||
|
|
||||||
type Team struct {
|
type Team struct {
|
||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
InitialName string `json:"initialName"`
|
InitialName string `json:"initialName"`
|
||||||
@ -143,7 +145,7 @@ func GetTryRank() ([]int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t Team) HasAccess(e Exercice) bool {
|
func (t Team) HasAccess(e Exercice) bool {
|
||||||
if e.Depend == nil {
|
if e.Depend == nil || UnlockedChallenges {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
ed := Exercice{}
|
ed := Exercice{}
|
||||||
|
Loading…
Reference in New Issue
Block a user