Exemplo n.º 1
0
func TestStartProgressForClueTeam(t *T) {
	beforeTeamProgressTest()
	err := table.StartProgress(3, 1)
	rdtest.Assert(t, err == nil, err)
	_, err = table.FindProgressByClueTeam(3, 1)
	rdtest.Assert(t, err == nil, err)
}
Exemplo n.º 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)
}
Exemplo n.º 3
0
//advances the team to the next clue
func advanceProgress(c *record.Clue, t *record.Team) error {

	//mark progress as answered
	table.FinishProgressForClueTeam(time.Now(), c.ClueId, t.TeamId)

	//get next clue in track
	track, err := table.FindTrack(t.TrackId)
	if err != nil {
		return err
	}

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

	//create new progress for the next clue id
	return table.StartProgress(nextClueId, t.TeamId)
}