Phase 5: reporting, exports, pronouns, and roster freshness
Instructor participation report: per-student histograms, outcome mix by class day, and a sortable table including the fairness ratio (answered calls over questions present for, with opt-out days out of the denominator), plus CSV exports of students, calls, and opt-outs. Assessment scales are now per-course data: ordered levels with labels and points out of 100 (defaults carry the old R grading values), with calls referencing levels by id so renames follow through to history. Renaming, re-pointing, reordering, and adding levels are always allowed; deleting a level in use by recorded calls is blocked. Pronouns and course term dates come from Canvas custom variable substitutions, at launch and roster-wide via rlid-scoped NRPS; the student page notes that names/pronouns are Canvas-sourced. Rosters can also be refreshed outside launches: a "Sync roster now" button and a sync-rosters CLI command for an hourly cron job, skipping ended courses. Alembic now runs SQLite-compatible batch migrations with a constraint naming convention. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,9 @@ def run_migrations_offline() -> None:
|
||||
target_metadata=target_metadata,
|
||||
literal_binds=True,
|
||||
dialect_opts={"paramstyle": "named"},
|
||||
# SQLite cannot ALTER constraints in place; batch mode uses the
|
||||
# copy-and-move strategy and is harmless on MariaDB/MySQL.
|
||||
render_as_batch=True,
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
@@ -70,7 +73,9 @@ def run_migrations_online() -> None:
|
||||
|
||||
with connectable.connect() as connection:
|
||||
context.configure(
|
||||
connection=connection, target_metadata=target_metadata
|
||||
connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
render_as_batch=True,
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
|
||||
30
migrations/versions/1ec230be46bd_student_pronouns.py
Normal file
30
migrations/versions/1ec230be46bd_student_pronouns.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""student pronouns
|
||||
|
||||
Revision ID: 1ec230be46bd
|
||||
Revises: 37acdb847a25
|
||||
Create Date: 2026-07-31 16:47:53.477882
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '1ec230be46bd'
|
||||
down_revision: Union[str, None] = '37acdb847a25'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('students', sa.Column('pronouns', sa.String(length=64), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('students', 'pronouns')
|
||||
# ### end Alembic commands ###
|
||||
32
migrations/versions/487d155678ea_course_term_dates.py
Normal file
32
migrations/versions/487d155678ea_course_term_dates.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""course term dates
|
||||
|
||||
Revision ID: 487d155678ea
|
||||
Revises: 1ec230be46bd
|
||||
Create Date: 2026-07-31 16:50:52.938563
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '487d155678ea'
|
||||
down_revision: Union[str, None] = '1ec230be46bd'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('courses', sa.Column('start_date', sa.Date(), nullable=True))
|
||||
op.add_column('courses', sa.Column('end_date', sa.Date(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('courses', 'end_date')
|
||||
op.drop_column('courses', 'start_date')
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,78 @@
|
||||
"""assessment levels and nrps details
|
||||
|
||||
Revision ID: 826e2835e289
|
||||
Revises: 487d155678ea
|
||||
Create Date: 2026-07-31 16:56:00.716357
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '826e2835e289'
|
||||
down_revision: Union[str, None] = '487d155678ea'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('assessment_levels', schema=None) as batch_op:
|
||||
batch_op.create_unique_constraint(batch_op.f('uq_assessment_levels_course_id'), ['course_id', 'label'])
|
||||
|
||||
with op.batch_alter_table('calls', schema=None) as batch_op:
|
||||
batch_op.create_foreign_key(batch_op.f('fk_calls_assessment_id_assessment_levels'), 'assessment_levels', ['assessment_id'], ['id'])
|
||||
batch_op.drop_column('assessment')
|
||||
|
||||
with op.batch_alter_table('class_days', schema=None) as batch_op:
|
||||
batch_op.create_unique_constraint(batch_op.f('uq_class_days_course_id'), ['course_id', 'date'])
|
||||
|
||||
with op.batch_alter_table('courses', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('lti_issuer', sa.String(length=255), nullable=True))
|
||||
batch_op.add_column(sa.Column('lti_client_id', sa.String(length=255), nullable=True))
|
||||
batch_op.add_column(sa.Column('nrps_url', sa.String(length=1024), nullable=True))
|
||||
batch_op.create_unique_constraint(batch_op.f('uq_courses_lti_context_id'), ['lti_context_id'])
|
||||
|
||||
with op.batch_alter_table('enrollments', schema=None) as batch_op:
|
||||
batch_op.create_unique_constraint(batch_op.f('uq_enrollments_course_id'), ['course_id', 'student_id'])
|
||||
|
||||
with op.batch_alter_table('optouts', schema=None) as batch_op:
|
||||
batch_op.create_unique_constraint(batch_op.f('uq_optouts_course_id'), ['course_id', 'student_id', 'date'])
|
||||
|
||||
with op.batch_alter_table('students', schema=None) as batch_op:
|
||||
batch_op.create_unique_constraint(batch_op.f('uq_students_canvas_user_id'), ['canvas_user_id'])
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('students', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(batch_op.f('uq_students_canvas_user_id'), type_='unique')
|
||||
|
||||
with op.batch_alter_table('optouts', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(batch_op.f('uq_optouts_course_id'), type_='unique')
|
||||
|
||||
with op.batch_alter_table('enrollments', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(batch_op.f('uq_enrollments_course_id'), type_='unique')
|
||||
|
||||
with op.batch_alter_table('courses', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(batch_op.f('uq_courses_lti_context_id'), type_='unique')
|
||||
batch_op.drop_column('nrps_url')
|
||||
batch_op.drop_column('lti_client_id')
|
||||
batch_op.drop_column('lti_issuer')
|
||||
|
||||
with op.batch_alter_table('class_days', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(batch_op.f('uq_class_days_course_id'), type_='unique')
|
||||
|
||||
with op.batch_alter_table('calls', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('assessment', sa.VARCHAR(length=32), nullable=True))
|
||||
batch_op.drop_constraint(batch_op.f('fk_calls_assessment_id_assessment_levels'), type_='foreignkey')
|
||||
|
||||
with op.batch_alter_table('assessment_levels', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(batch_op.f('uq_assessment_levels_course_id'), type_='unique')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user