Hi,
There must be a better way to do this, but this is what I have at the moment. The function never executes the logic in the 2nd elif statement.
I am trying to calculate the total score for a group of questions and then applying some different calculations to the total score.
I’m using else and elif based on the question_id
but it doesn’t work.
if q.id == 9 :
questionnaire_score = []
for answer in all_q_answered:
# Section 1 Scoring
if answer.question_id == 133:
do some calculations
questionnaire_score.append(cfscore)
# Section 2 Scoring
elif answer.question_id == 134 or 135 or 136 or 137 or 138 or 139:
do some calcualtions
questionnaire_score.append(cfscore)
# Section 3 Scoring
elif answer.question_id == 140 or 141 or 142 or 143 or 144 or 145:
do some calculations
questionnaire_score.append(cfscore)
else:
pass
...
Why would it be doing this?
Thanks