Example #1
0
func solveClue(ctx *_Context) (err error) {

	req := ctx.req.(*_SolveClueReq)
	err = clues.Answer(
		ctx.urlParams["clue_id"].(int64),
		ctx.loggedIn.Team.TeamId,
		req.Answer,
	)

	if err != nil {
		return
	}

	curr, err := clues.CurrentForTeam(
		ctx.loggedIn.Team.TeamId,
		clues.NoExpectedId,
	)

	//never display an advancement reason after answering a question
	curr.AdvancementReason = ""

	ctx.resp = curr

	return
}
Example #2
0
func TestAnswerCorrectVariation(t *testing.T) {
	beforeAnswerTest()

	err := clues.Answer(1, 1, "   1ba   ")
	rdtest.Assert(t, err == nil, err)

	p, err := table.FindClueWithProgressForTeam(1)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, p.Clue.ClueId == 2)
}
Example #3
0
func TestAnswer_Wrong(t *testing.T) {
	beforeAnswerTest()

	err := clues.Answer(1, 1, "wrong answer")
	rdtest.Assert(t, err == clues.WrongAnswer, err)
}