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>
79 lines
3.6 KiB
Python
79 lines
3.6 KiB
Python
"""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 ###
|