Write docs!
This commit is contained in:
parent
c460bb7bf5
commit
bcc598ebd5
37 changed files with 478 additions and 188 deletions
|
|
@ -2,6 +2,7 @@ package fic
|
|||
|
||||
import ()
|
||||
|
||||
// truncateTable performs an insecure wipe on the given tables.
|
||||
func truncateTable(tables ...string) (error) {
|
||||
if _, err := DBExec("SET FOREIGN_KEY_CHECKS = 0;"); err != nil {
|
||||
return err
|
||||
|
|
@ -17,14 +18,17 @@ func truncateTable(tables ...string) (error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ResetGame resets all tables containing team attempts and solves.
|
||||
func ResetGame() (error) {
|
||||
return truncateTable("team_hints", "key_found", "mcq_found", "exercice_solved", "exercice_tries")
|
||||
}
|
||||
|
||||
// ResetExercices wipes out all challenges (both attempts and statements).
|
||||
func ResetExercices() (error) {
|
||||
return truncateTable("team_hints", "exercice_files", "key_found", "exercice_keys", "exercice_solved", "exercice_tries", "exercice_hints", "mcq_found", "mcq_entries", "exercice_mcq", "exercices", "themes")
|
||||
}
|
||||
|
||||
// ResetTeams wipes out all teams, incluings members and attempts.
|
||||
func ResetTeams() (error) {
|
||||
return truncateTable("team_hints", "key_found", "mcq_found", "exercice_solved", "exercice_tries", "team_members", "teams")
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue