sync: implement hint dependency on flags
This commit is contained in:
parent
20f2597248
commit
6740256a32
6 changed files with 72 additions and 2 deletions
|
|
@ -155,6 +155,25 @@ func (t Team) CanDownload(f EFile) bool {
|
|||
}
|
||||
}
|
||||
|
||||
// CanSeeHint checks if the Team has access to the given hint.
|
||||
func (t Team) CanSeeHint(h EHint) bool {
|
||||
if deps, err := h.GetDepends(); err != nil {
|
||||
log.Printf("Unable to retrieve flag dependencies: %s\n", err)
|
||||
return false
|
||||
} else {
|
||||
res := true
|
||||
|
||||
for _, dep := range deps {
|
||||
if t.HasPartiallySolved(dep) == nil {
|
||||
res = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
// CanSeeFlag checks if the Team has access to the given flag.
|
||||
func (t Team) CanSeeFlag(k Flag) bool {
|
||||
if deps, err := k.GetDepends(); err != nil {
|
||||
|
|
|
|||
Reference in a new issue