Show a student which class each text belongs to - #1235
Conversation
A student in more than one class gets one merged classroom list, and until now it was a pile of texts with no way to tell whose lesson was whose. Each text now carries its class as a tag in the metadata strip, suppressed for the 2,484 students who have exactly one class and would see the same answer on every row. ArticlePreview renders two layouts and both have their own MetaStrip, so the tags are built once next to the other tag slots rather than inside either branch. Putting them in only one is a silent no-op for the classroom, which is exactly what happened first time. The class page also tells the teacher when it holds texts in a language its students are not learning -- those texts are invisible to the whole class, and the teacher is the only person who can do anything about it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
✅ Deploy Preview for voluble-nougat-015dd1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Review follow-ups. - `cohort.language` is null for a class whose language was never set, and every language then failed the "is this off-language?" test, so the banner claimed the whole list was unreachable and left a hole in its own sentence where the language name should be. Both halves were false: the student filter compares the *article's* language to the *student's* learned language and never consults the class's. Six such classes exist; none holds a text yet, which is the only reason this was not already visible. - The classroom waited for getStudent before choosing an empty-state message but not before rendering the list, so the class tags -- which need to know whether the student has more than one class -- rendered absent and then appeared when that request landed. It waits in both paths now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Two review fixes pushed (586e725), plus one behaviour change I should have called out in the description. A class with no language warned that all its texts were hidden. The class tags popped in a beat late. The classroom waited for Behaviour change worth knowing (zeeguu/api#719): a text shared with two of a student's classes used to be appended once per class and therefore rendered twice. It now appears once, tagged with both class names. That's the better behaviour and there's a test for it, but it changes what an existing student sees and arrived as a side effect of adding attribution rather than as a stated goal. |
The cohort id is a number in every payload now (api#719), but useParams() always hands back a string, so the two places that matched one against the other were relying on the API's odd stringification to work at all. Adds the regression this closes: a class shared during a session (ids from /cohorts_info) and the same class after a reload (ids from /teacher_texts) used to build two separate filter chips. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Needs zeeguu/api#719 deployed first. Without it
from_classesis absent and the tag simply doesn't render.Why
Our pilot teacher joined a second class and asked whether he had to delete his enrolment in the first one to see its texts. He didn't — but the app never told him that, because the classroom is a merged list with no provenance. A student with two classes sees one pile and can't tell whose lesson is whose.
What
Each text carries its class as a tag in the metadata strip:
Suppressed for the 2,484 students who have exactly one class and would otherwise see the same answer on every row. Only 18 students are in two classes, so this is deliberately invisible to almost everyone.
Note for review:
ArticlePreviewrenders two layouts — the interactive card and the preview/headlines teaser — and each has its ownMetaStrip. The tags are built once beside the other tag slots (savedTag,publishedTimeSlot) rather than inside either branch. I put them in thepreviewModestrip first, which is a silent no-op for the classroom feed, sinceinteractivedefaults totrueand that branch is never taken there. Worth knowing before adding anything else to those strips.Also: telling the teacher what their class hides
The class Texts tab now says when the class holds texts in a language its students aren't learning:
7 classes are in that state today, holding 32 texts, affecting 54 students (none active since June). The teacher is the only person who can fix it — a student's only "fix" would be to abandon the language they chose — so the count goes to them rather than into the student's feed.
Verified
Both variants in the browser: tags render for a multi-class student, suppressed for a single-class one; the teacher warning renders with a realistic mix.
48 tests, build clean.