ui: Add a progress bar indicating total number of flags
This commit is contained in:
parent
3c42bef298
commit
815f4b9037
2 changed files with 21 additions and 5 deletions
|
|
@ -61,6 +61,7 @@ type myTeamExercice struct {
|
|||
Gain int `json:"gain"`
|
||||
Files []myTeamFile `json:"files,omitempty"`
|
||||
Flags []myTeamFlag `json:"flags,omitempty"`
|
||||
NbFlags int `json:"nb_flags,omitempty"`
|
||||
SolveDist int64 `json:"solve_dist,omitempty"`
|
||||
SolvedTime *time.Time `json:"solved_time,omitempty"`
|
||||
SolvedRank int64 `json:"solved_rank,omitempty"`
|
||||
|
|
@ -189,6 +190,13 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||
return nil, err
|
||||
} else {
|
||||
for _, k := range flags {
|
||||
exercice.NbFlags += 1
|
||||
|
||||
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(k) {
|
||||
// Dependancy missing, skip the flag for now
|
||||
continue
|
||||
}
|
||||
|
||||
flag := myTeamFlag{
|
||||
Id: k.Id,
|
||||
Type: k.Type,
|
||||
|
|
@ -196,11 +204,6 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||
Help: k.Help,
|
||||
}
|
||||
|
||||
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(k) {
|
||||
// Dependancy missing, skip the flag for now
|
||||
continue
|
||||
}
|
||||
|
||||
// Retrieve solved state or solution for public iface
|
||||
if t == nil {
|
||||
flag.IgnoreCase = k.IgnoreCase
|
||||
|
|
@ -255,6 +258,8 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||
return nil, err
|
||||
} else {
|
||||
for _, mcq := range mcqs {
|
||||
exercice.NbFlags += 1
|
||||
|
||||
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(mcq) {
|
||||
// Dependancy missing, skip the flag for now
|
||||
continue
|
||||
|
|
|
|||
Reference in a new issue