pdf-quiz-generator/backend/alembic/versions/d0e1f2a3b4c5_repetition.py
Daniel 2d828c3c03 feat: a repetition does not raise your score; no more deleting a session
Sitting the same questions again is practice, not a new measurement. You
have already seen the answers, so getting them right the second time
says nothing about whether you knew them — and it cannot be allowed to
raise a figure that means "how much of this do you know". A repeated
session is titled "(repetition)", analysed in full on its own page, and
left out of every aggregate: the overall accuracy, the per-quiz history,
the averages, and the readiness that drives recommendations.

Deleting a single session is gone — control, endpoint, tests and all. A
session is a record of work done, and removing one edits the history
every figure on the analysis is computed from, which turns a measurement
into a number somebody chose. Starting again is still offered whole,
under Settings, Your data, which takes everything rather than the parts
that flatter.

Two layout bugs behind that. The category tree kept its appearance in
QuestionBankPage.css, so it looked right on the bank and took whatever
the host page did to a label everywhere else — in the question editor
that centred the name, leaving it adrift with the count at the far
right; it owns its own stylesheet now. And the editor's grid collapsed
to `1fr` below 900px, whose automatic minimum lets one unshrinkable
child push the column past the window: the page had padding down its
left and none down its right because the right was off the screen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqXevQJhxFrM7jJg82cgZN
2026-09-12 01:08:42 +02:00

28 lines
939 B
Python

"""Mark a repeated session as a repetition.
Sitting the same questions again is practice, not a new measurement: the
answers have already been seen, so getting them right the second time says
nothing about whether they were known. Such a session is still analysed on its
own page — that is the point of repeating it — but it is left out of the
figures that claim to say how much of the bank you know.
Revision ID: d0e1f2a3b4c5
Revises: c9d0e1f2a3b4
"""
import sqlalchemy as sa
from alembic import op
revision = "d0e1f2a3b4c5"
down_revision = "c9d0e1f2a3b4"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("quizzes", sa.Column("is_repetition", sa.Integer(), server_default="0"))
op.create_index("ix_quizzes_is_repetition", "quizzes", ["is_repetition"])
def downgrade() -> None:
op.drop_index("ix_quizzes_is_repetition", table_name="quizzes")
op.drop_column("quizzes", "is_repetition")