If a user would be working on a questionnaire, it would be nice if the user could continue where he left off in the questionnaire when he signs in the next day. A way to achieve this is to store certain data in the User profile (the data item User).
To do this, we first use the data item User to store the current questionnaire. Then, we use the flow part My current question to find the question in that questionnaire that he needs to answer.
We have the following data items in the application:
Questionnaire: the questionnaires that are used in the organisation.
Question: the questions that belong to them.
My Questionnaire: the questionnaires that are assigned to users.
My question: copies of the questions that are assigned to users.
When a teacher assigns a questionnaire to a student, a flow partcopies therelated questions to My questions. The reason for this is that the questionnaire might change during or after the time that the student works on it. You don’t want the student to be affected by those changes.
2. User profile
In the data item User, add the reference Current questionnaire to User and reference it to Questionnaire.
A user can have only one Current questionnaire. A questionnaire can have more than one user who is currently working on it.
This way, the user can select the questionnaire he is working on and the teacher can see who is working on a questionnaire.
3. Only show questions that need to be answered
The user flow My current question shows the question that needs to be answered. We need some properties and a flow part to achieve this.
The following properties of My question are used to keep track of answered questions:
- Questionnaire - Question number - This question was answered (true/false or date/time)
Design the flow part My current question
Start with the input User / Current user.
Find the next question to answer with a look up from My question. Questionnaire = Input / User / Current questionnaire AND Answered on = Empty AND User = Input / User
Generate a single My question, sorted on number, smallest to largest.
The result will be: the next question to answer OR no question (if all questions are answered), in which case the flow edits the My questionnaire as Completed.
The output will be the question that has to be answered or no question at all.
Design the user flow My current question
If there is a current questionnaire: get the current question. If not: tell the user that he must select one. Then exit to My questionnaires.
If the flow part My current question returns a question: show the page Answer current question. After the user presses Done, store the answer and look for the next question to be answered.
If no question is returned: this means that the user has answered all questions. Congratulate the user and exit to My questionnaires.