Example #1
0
func Begin(teamId int64) error {
	track, err := table.FindTrackForTeam(teamId)
	if err != nil {
		return err
	}

	_, err = table.CreateTeamProgress(teamId, track.QuestionIdOrder[0])
	return err
}
Example #2
0
func Advance(clueId, teamId int64) error {
	err := table.FinishProgressForClueTeam(time.Now(), clueId, teamId)
	if err != nil {
		return err
	}

	track, err := table.FindTrackForTeam(teamId)
	if err != nil {
		return err
	}

	//get next clue id
	nextClueId, err := track.NextClue(clueId)
	if err != nil {
		return err
	}

	//create new progress for the next clue id
	return table.StartProgress(nextClueId, teamId)
}
Example #3
0
func TestFindTrackForTeam(t *T) {
	beforeTrackTest()
	track, err := table.FindTrackForTeam(1)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, track.TrackId == 1, "%d", track.TrackId)
}