sync: add dependency on flag to download file
This commit is contained in:
parent
dcfb34c6fd
commit
1e2a74f3ca
9 changed files with 112 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
|||
package fic
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -104,6 +105,25 @@ func (t Team) HasAccess(e Exercice) bool {
|
|||
}
|
||||
}
|
||||
|
||||
// CanDownload checks if the Team has access to the given file.
|
||||
func (t Team) CanDownload(f EFile) bool {
|
||||
if deps, err := f.GetDepends(); err != nil {
|
||||
log.Printf("Unable to retrieve file dependencies: %s\n", err)
|
||||
return false
|
||||
} else {
|
||||
res := true
|
||||
|
||||
for _, dep := range deps {
|
||||
if t.HasPartiallySolved(dep) == nil {
|
||||
res = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
// NbTry retrieves the number of attempts made by the Team to the given challenge.
|
||||
func NbTry(t *Team, e Exercice) int {
|
||||
var cnt *int
|
||||
|
|
Reference in a new issue