示例#1
0
文件: clue.go 项目: pjherring/ggc
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
}
示例#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)
}
示例#3
0
func TestAnswer_Wrong(t *testing.T) {
	beforeAnswerTest()

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