implement choices_cost
This commit is contained in:
parent
f9abdd23c6
commit
476f0f553c
18 changed files with 180 additions and 24 deletions
|
@ -173,6 +173,19 @@ func (t Team) OpenHint(h EHint) (error) {
|
|||
return err
|
||||
}
|
||||
|
||||
// SeeChoices checks if the Team has revealed the given choices.
|
||||
func (t Team) SeeChoices(k Flag) (bool) {
|
||||
var tm *time.Time
|
||||
DBQueryRow("SELECT MIN(time) FROM team_wchoices WHERE id_team = ? AND id_flag = ?", t.Id, k.Id).Scan(&tm)
|
||||
return tm != nil
|
||||
}
|
||||
|
||||
// DisplayChoices registers to the database that the Team has now revealed.
|
||||
func (t Team) DisplayChoices(k Flag) (error) {
|
||||
_, err := DBExec("INSERT INTO team_wchoices (id_team, id_flag, time) VALUES (?, ?, ?)", t.Id, k.Id, time.Now())
|
||||
return err
|
||||
}
|
||||
|
||||
// CountTries gets the amount of attempts made by the Team and retrieves the time of the latest attempt.
|
||||
func (t Team) CountTries(e Exercice) (int64, time.Time) {
|
||||
var nb *int64
|
||||
|
|
Reference in a new issue