ui: Add a progress bar indicating total number of flags
This commit is contained in:
parent
3c42bef298
commit
815f4b9037
@ -8,6 +8,7 @@
|
|||||||
Icon,
|
Icon,
|
||||||
ListGroup,
|
ListGroup,
|
||||||
ListGroupItem,
|
ListGroupItem,
|
||||||
|
Progress,
|
||||||
Spinner,
|
Spinner,
|
||||||
} from 'sveltestrap';
|
} from 'sveltestrap';
|
||||||
|
|
||||||
@ -97,6 +98,16 @@
|
|||||||
<Icon name="flag-fill" />
|
<Icon name="flag-fill" />
|
||||||
Faire son rapport
|
Faire son rapport
|
||||||
</CardHeader>
|
</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}
|
{#if exercice.tries || exercice.submitted || sberr}
|
||||||
<ListGroup>
|
<ListGroup>
|
||||||
{#if exercice.solved_time && exercice.tries}
|
{#if exercice.solved_time && exercice.tries}
|
||||||
|
@ -61,6 +61,7 @@ type myTeamExercice struct {
|
|||||||
Gain int `json:"gain"`
|
Gain int `json:"gain"`
|
||||||
Files []myTeamFile `json:"files,omitempty"`
|
Files []myTeamFile `json:"files,omitempty"`
|
||||||
Flags []myTeamFlag `json:"flags,omitempty"`
|
Flags []myTeamFlag `json:"flags,omitempty"`
|
||||||
|
NbFlags int `json:"nb_flags,omitempty"`
|
||||||
SolveDist int64 `json:"solve_dist,omitempty"`
|
SolveDist int64 `json:"solve_dist,omitempty"`
|
||||||
SolvedTime *time.Time `json:"solved_time,omitempty"`
|
SolvedTime *time.Time `json:"solved_time,omitempty"`
|
||||||
SolvedRank int64 `json:"solved_rank,omitempty"`
|
SolvedRank int64 `json:"solved_rank,omitempty"`
|
||||||
@ -189,6 +190,13 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
for _, k := range flags {
|
for _, k := range flags {
|
||||||
|
exercice.NbFlags += 1
|
||||||
|
|
||||||
|
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(k) {
|
||||||
|
// Dependancy missing, skip the flag for now
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
flag := myTeamFlag{
|
flag := myTeamFlag{
|
||||||
Id: k.Id,
|
Id: k.Id,
|
||||||
Type: k.Type,
|
Type: k.Type,
|
||||||
@ -196,11 +204,6 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||||||
Help: k.Help,
|
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
|
// Retrieve solved state or solution for public iface
|
||||||
if t == nil {
|
if t == nil {
|
||||||
flag.IgnoreCase = k.IgnoreCase
|
flag.IgnoreCase = k.IgnoreCase
|
||||||
@ -255,6 +258,8 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
for _, mcq := range mcqs {
|
for _, mcq := range mcqs {
|
||||||
|
exercice.NbFlags += 1
|
||||||
|
|
||||||
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(mcq) {
|
if !DisplayAllFlags && t != nil && !t.CanSeeFlag(mcq) {
|
||||||
// Dependancy missing, skip the flag for now
|
// Dependancy missing, skip the flag for now
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user