A session is the durable record for one student’s practice test. It gives that attempt a unique ID, starts correct and incorrect counts at zero, and links the selected questions to the same test so progress can be tracked instead of treating every page load as a new attempt. section 5.3.8 section 5.3.10
A session supports the test workflow by storing and connecting:
- A unique session ID, created as the primary key for the session record. section 5.3.8
- Correct and incorrect answer counts, both initialized to zero before the student answers questions. section 5.3.8
- Thirty-five randomly selected questions, inserted into question_sets with the session ID. section 5.3.9
- A browser-visible identifier that can be stored in a cookie to recover the same session after a browser closes. section 6.2.1
Create and verify a test attempt
Create a Session, save its generated ID, and insert a question set tied to that ID. Then inspect the database: a new session should have no answers counted yet, while question_sets should contain 35 rows associated with its session_id. If an AI-generated revision causes an import or object-lifecycle error, correct and test it rather than copying it blindly. section 5.3.9 section 5.3.10 section 6.2.1
Figure 5.31 The relationship between sessions and questions sets in our database
Use the relationship diagram to see how a session ID connects one test attempt to its selected question records. section 5.3.8
