praekelt/go-nike-ghr — pull request #19 by imsickofmaps (2013-07-08 15:08:56+00:00)
Title: Weekly Quizzes creation and json api exposure

## Basics

* Similar but not the same as the M&L quiz (which is more like a survey).
* Needs a weekly quiz model
* Each quiz will have 3 questions with 3 options (each with a related response)
* Total quiz question and answers should not exceed 160 characters (this should be validated in admin UI - server side) per question
* Total quiz related response to each question answer should not exceed 160 characters
* Old quizzes will just be ignored, the api should return just the newest "published" quiz

There need to be just one endpoint

**GET /api/weeklyquiz/**

Returns this weeks quiz:

{
"quiz": {
"start": "q_1",
"quiz_details": {
"answers": {
"q_1_a_1": {
"response": "Yes - Genius",
"next": "q_2"
},
"q_1_a_2": {
"response": "No - Dur",
"next": "q_2"
},
"q_1_a_3": {
"response": "No - Dur",
"next": "q_2"
},
"q_2_a_1": {
"response": "No - Dur",
"next": "q_3"
},
"q_2_a_2": {
"response": "Yes - Genius",
"next": "q_3"
},
"q_2_a_3": {
"response": "No - Dur",
"next": "q_3"
},
"q_3_a_1": {
"response": "No - Dur",
"next": "main_menu"
},
"q_3_a_2": {
"response": "No - Dur",
"next": "main_menu"
},
"q_3_a_3": {
"response": "Yes - Genius",
"next": "main_menu"
}
},
"questions": {
"q_1": {
"question": "Am I fake question 1?",
"choices": [
[
"q_1_a_1",
"Yes!"
],
[
"q_1_a_2",
"No!"
],
[
"q_1_a_3",
"Maybe!"
]
]
},
"q_2": {
"question": "Am I fake question 2?",
"choices": [
[
"q_2_a_1",
"Yes!"
],
[
"q_2_a_2",
"No!"
],
[
"q_2_a_3",
"Maybe!"
]
]
},
"q_3": {
"question": "Am I fake question 3?",
"choices": [
[
"q_3_a_1",
"Yes!"
],
[
"q_3_a_2",
"No!"
],
[
"q_3_a_3",
"Maybe!"
]
]
}
}
}
}
}

If there is no quiz should just respond:

{"quiz": false}