Closed eliasmalik closed 8 years ago
Updates to the URL structure and backend logic for new questionnaires section:
1. GET /questionnaires/new
1.1 User selects which categories for the questionnaire
1.2 User submits the form
2. POST /questionnaires/new/register
2.1 Create new uncompleted questionnaire for logged in user
2.2 Fill in categories for newly created questionnaire
2.3 GET /questionnaires/{QUID}/questions
3. GET /questionnaires/{QUID}/questions
3.0 Check if QUID is marked as completed
3.0.1 If completed, GET /questionnaires/new
3.1 Get questions for questionnaire QUID
3.1.1 Get categories for QUID
3.1.2 Get questions for categories
3.1.3 Get answers for QUID (if exist)
3.2 Create templating data object w/ questions and answers
3.3 Render view
3.4 User completes questionnaire and submits the form
4. POST /questionnaires/{QUID}/answers
4.0 Check if QUID is marked as completed
4.0.1 If completed, GET /questionnaires/new
4.1 Upsert all answers into the DB
4.2 Redirect to /questionnaires/{QUID}/summary
5. GET /questionnaires/{QUID}/summary
5.1 Get answers for QUID from DB
5.2 Get question texts for all relevant questions from DB
5.3 Parse answers into array of objects with qid, answer fields
5.4 Form templating object w/ question text and answer boolean flags
5.5 Render view
5.6 User confirms answers
5.6.1 POST /questionnaires/{QUID}/complete
or
5.7 User clicks back to make changes
5.7.1 GET /questionnaires/{QUID}/questions
6. POST /questionnaires/{QUID}/complete
6.2 Mark questionnaire as completed
6.3 Redirect to /dashboard
Addressed by #59 and #62
Aim to implement the following url structure
Views:
API: