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>
49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
import pytest
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from coldcall_lti import create_app
|
|
from coldcall_lti.config import Config
|
|
from coldcall_lti.db import Base
|
|
|
|
|
|
@pytest.fixture
|
|
def db_session():
|
|
engine = create_engine("sqlite://")
|
|
Base.metadata.create_all(engine)
|
|
session = sessionmaker(bind=engine)()
|
|
yield session
|
|
session.close()
|
|
engine.dispose()
|
|
|
|
|
|
def make_app(tmp_path, dev_mode=True):
|
|
class TestConfig(Config):
|
|
TESTING = True
|
|
DATABASE_URL = f"sqlite:///{tmp_path}/test.sqlite3"
|
|
DEV_MODE = dev_mode
|
|
SECRET_KEY = "test"
|
|
|
|
app = create_app(TestConfig)
|
|
Base.metadata.create_all(app.extensions["db_engine"])
|
|
return app
|
|
|
|
|
|
@pytest.fixture
|
|
def dev_client(tmp_path):
|
|
return make_app(tmp_path, dev_mode=True).test_client()
|
|
|
|
|
|
def outcome_actions(page):
|
|
"""Map outcome button labels to their form values on a live page,
|
|
e.g. {'GOOD': 'level-1', ..., 'Missing': 'missing'}."""
|
|
import re
|
|
|
|
return {
|
|
label.strip(): value
|
|
for value, label in re.findall(
|
|
r'<button type="submit" name="action" value="([^"]+)">([^<]+)</button>',
|
|
page,
|
|
)
|
|
}
|