To summarise, I have a list of questions in table questions, a list of possible answers in table answers and a table called user_answers with the selected answers from the users.
There are endpoints in my application that allow the user to display the questions and answers, answer them and display a summary of the questions for the user.
Currently, I handle this data model by creating all answers related to a user on user creation (they are unchecked by default). This way of handling things allows us to always know that a user answer is available (the user_answer model has some fields that are updated dynamicaly and knowing that the record are already there simplifies some logic). On the other hand, it seems weird to create a lot of empty records in the database for this.
What are the good practices related to this kind of problem?
Should I create records in user_answers only when the user answers a question or is this OK to create all records from the beginning?
Thank you
answeractually is / means for someone who hasn't even attempted thequestionyet. Seeing what exactly you're updating in ananswermay help clarify that. – J.D. Jul 19 '22 at 12:27