ui: Add a progress bar indicating total number of flags
This commit is contained in:
parent
3c42bef298
commit
815f4b9037
@ -8,6 +8,7 @@
|
||||
Icon,
|
||||
ListGroup,
|
||||
ListGroupItem,
|
||||
Progress,
|
||||
Spinner,
|
||||
} from 'sveltestrap';
|
||||
|
||||
@ -97,6 +98,16 @@
|
||||
<Icon name="flag-fill" />
|
||||
Faire son rapport
|
||||
</CardHeader>
|
||||
{#if exercice.flags.length != exercice.nb_flags}
|
||||
<Progress
|
||||
value={exercice.flags.length}
|
||||
max={exercice.nb_flags}
|
||||
class="rounded-0"
|
||||
barClassName="text-light"
|
||||
>
|
||||
{exercice.flags.length}/{exercice.nb_flags}
|
||||
</Progress>
|
||||
{/if}
|
||||
{#if exercice.tries || exercice.submitted || sberr}
|
||||
<ListGroup>
|
||||
{#if exercice.solved_time && exercice.tries}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user