Creating quiz submissions

Hi there, I’m creating a platform to host multiple quizzes amongst other things but I’m struggling with the final piece of the scoring.

I currently have the following data types:

Quiz: Name (text), Number of questions (number)
Question: Quiz (quizzes), Text (text), Answer 1 (text), Answer 2 (text), Correct answer (text), Score (number)
Submission: Quiz (quizzes), Respondent (user), Questions answered (number), Score (number)

On my page, I have a repeating group which cycles through each of that particular quizzes’ questions, randomly orders the two items (answers) as clickable buttons.

What I’m struggling with is storing the submission. So at the moment, when you click the answer button, my workflow Searches for submissions with the current user as the respondent and the current quiz as the quiz and if that count = 0 it creates a new one with all relevant info and sets the score to 0.

The next step then checks if this item’s answer = the items question’s Correct Answer and if it does it then increments the score by 10 and adds 1 to the questions answers field via an “only if” statement.

The issue is then on the second question, because there IS now a submission for the user the whole thing seems to fall down. What am I missing in terms of updating that specific submission?

Screenshot 2021-01-25 at 15.54.06 Screenshot 2021-01-25 at 15.54.15

Hi @alastair

One thing I noticed is, shouldn’t a quiz have multiple questions? Instead you have question has multiple quizzes. I say that because you are constraining by the current page quiz. Therefore a submission should have a quiz (singular)

I would consider having the following DB
Quiz
Name (text)
Number of questions (number)
Question ( list of questions)
submission (list of submissions)
Question
theQuestion (text)
answerChoiceA (text)
answerChoiceB (text)
correctAnswer (text)
questionScoreValue (number)
Submission
CreatedBy(user)
answeredQuestion (list of questions)
quiz (quiz)
answerSelected(text)
score (number)
Users
Quiz (list of quizzes)

with this structure you can now have a quiz page that has a list of questions. Once user select answer for a quiz,
do a search for submission where the quiz = current page quiz count is 0. If not modify a submission. Add the question to the list of answered Questions and if the answer is created +scoreValue to the submission score.

I know this does not answer your question directly, but helpfully it provide some usefulness when thinking about DB schemes and connecting some of the moving pieces you have there

Cheers

Thanks for the suggestions - I’ll have a look into that. For clarity - i’ve written quizzes with the intentions of saying that I select that Question’s Quiz from the list of Quizzes, not that it has multiple.

That being said, I think what you’re saying still makes sense!