How to allocate users a score based on their answers to a question or series of questions: Difference between revisions
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
In this example, users are asked to answer '''No, Sometimes, Regularly or Often''' to questions, which are scored as '''1, 2, 3 or 4''' respectively. | In this example, users are asked to answer '''No, Sometimes, Regularly or Often''' to questions, which are scored as '''1, 2, 3 or 4''' respectively. | ||
There are 3 pages: qp1, qp2 and qfeedback. | |||
4 numeric interactions: qp1, qp2, qp3 and qp4) | |||
This logic is a simple example showing how to calculate a score and show it to a user. | This logic is a simple example showing how to calculate a score and show it to a user. | ||
Line 48: | Line 49: | ||
set anxiety_total to (sum(anxiety1, anxiety2)) | set anxiety_total to (sum(anxiety1, anxiety2)) | ||
show | show qfeedback | ||
set | set qfeedback.depress_score to depress_total | ||
set | set qfeedback.anxiety_score to anxiety_total</code> |
Revision as of 11:53, 19 August 2015
You can can use logic to calculate scores based on the responses users give to questions.
Example 1
In this example, users are asked to answer No, Sometimes, Regularly or Often to questions, which are scored as 1, 2, 3 or 4 respectively.
There are 3 pages: qp1, qp2 and qfeedback. 4 numeric interactions: qp1, qp2, qp3 and qp4) This logic is a simple example showing how to calculate a score and show it to a user.
set depress1 to 50
set depress2 to 50
set anxiety1 to 50
set anxiety2 to 50
The logic above sets the emotions to 50 so if something is not saved, you will know about it when you look at your data (this is just an extra precaution).
show page qp1
if (qp1.q1 = 0) set depress1 to 0
if (qp1.q1 = 1) set depress1 to 1
if (qp1.q1 = 2) set depress1 to 2
if (qp1.q1 = 3) set depress1 to 3
if (qp1.q1 = 4) set depress1 to 4
if (qp1.q2 = 0) set anxiety1 to 0
if (qp1.q2 = 1) set anxiety1 to 1
if (qp1.q2 = 2) set anxiety1 to 2
if (qp1.q2 = 3) set anxiety1 to 3
if (qp1.q2 = 4) set anxiety1 to 4
show page qp2
if (qp1.q1 = 0) set depress2 to 0
if (qp1.q1 = 1) set depress2 to 1
if (qp1.q1 = 2) set depress2 to 2
if (qp1.q1 = 3) set depress2 to 3
if (qp1.q1 = 4) set depress2 to 4
if (qp1.q2 = 0) set anxiety2 to 0
if (qp1.q2 = 1) set anxiety2 to 1
if (qp1.q2 = 2) set anxiety2 to 2
if (qp1.q2 = 3) set anxiety2 to 3
if (qp1.q2 = 4) set anxiety2 to 4
set depress_total to (sum(depress1, depress2))
set anxiety_total to (sum(anxiety1, anxiety2))
show qfeedback
set qfeedback.depress_score to depress_total
set qfeedback.anxiety_score to anxiety_total