Search⌘ K
AI Features

Identifying the Data of Our Project—Continued

Explore how to define and organize the data layer for a quiz project in Elixir. Learn to create structs that represent user responses and quizzes, track questions, answers, and mastery progress. Understand how data structure design informs program logic before coding.

The user answers with responses

When a user answers a question, we’ll generate a response. Our responses don’t need too much data. We’ll track extra data we might have otherwise computed to make it easy to debug and reason about the program. This is the data we want to track:

  • quiz_title (String.t): Title field from the quiz.

  • template_name (atom): Name field identifying the template.

  • to (String.t): The question being answered, as in “this is a response to the asked question.”

  • email (String.t): The email address of the user answering the question.

  • answer (String.t): The answer provided by the user.

  • correct (boolean): Whether the given answer was correct.

  • ...