Beispiel #1
0
func TestFindClue(t *T) {
	beforeClueTest()
	clue, err := table.FindClue(1)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, clue != nil)
	rdtest.Assert(t, clue.Text == "Text 1")
}
Beispiel #2
0
//Answer will try the potential answer and advance the progress if correct
func Answer(clueId, teamId int64, potential string) error {
	clue, err := table.FindClue(clueId)
	if err != nil {
		return err
	}

	if !clue.TryAnswer(potential) {
		return WrongAnswer
	}

	return progress.Advance(clueId, teamId)
}
Beispiel #3
0
//Start progress on a track for a team
func startTrackForTeam(team *record.Team) (*models.Clue, error) {

	track, err := table.FindTrack(team.TrackId)
	if err != nil {
		return nil, err
	}

	//find the clue
	clue, err := table.FindClue(track.QuestionIdOrder[0])
	if err != nil {
		return nil, err
	}

	_, err = table.CreateTeamProgress(team.TeamId, clue.ClueId)
	if err != nil {
		return nil, err
	}

	return models.ClueFromCurrentClue(clue), nil
}