Skip to content

Institution roster: count a mentored student as Current even when her report isn't joined - #226

Merged
maciejpilarski merged 7 commits into
trunkfrom
fix/222-mentored-student-current
Sep 28, 2026
Merged

maciejpilarski merged 7 commits into
trunkfrom
fix/222-mentored-student-current

Conversation

@4thhubbard

Copy link
Copy Markdown
Contributor

Fixes #222.

The Institution Dashboard put a student under "Waiting for a mentor" while her own profile showed her mentor.

Cause. WPCPM_Roster_Index::groups() split Current from Waiting only on reports, the Students Reports rows the students sync joins to a Students row. That join is by email alone (join_students_rows()). When the two tables hold different addresses for the student, or her address is on a second Students row filed under another institution, reports stays empty. The mentor is still on the Students row (has_mentor), and the student card reads the reports row directly, so the two screens disagree.

Change.

  • groups(): a tracked current student is Current when she has a mentor or a report record, and Waiting only when she has neither.
  • Administrators Dashboard: its "Waiting for a mentor" count uses the same rule so the two numbers agree.
  • Group notes on the roster now describe the groups by mentor assignment.
  • The mentor cell still says "A mentor is assigned. The report record has not been created yet." for these rows, so the program team can still spot the address mismatch.

This reverses a deliberate choice: the old tests pinned a mentored student with no report record under Waiting. @maciejpilarski, please confirm you're OK with that before merging.

Tests.

  • New regression in bin/test-students-sync.php that runs the real sync with mismatched addresses and checks the student lands in Current.
  • test-institution-roster-view.php, test-institution-export.php and test-institution-roster.php updated for the new rule.
  • All 106 bin/test-*.php suites pass.

The data fix for the Liceo La Paz student is separate: align her email across Students and Students Reports, or remove the duplicate Students row.

🤖 Generated with Claude Code

https://claude.ai/code/session_012s7S18Xzuq6cbbeysJ5XFY

@maciejpilarski maciejpilarski left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @4thhubbard , and yes, I am fine with reversing the call. The school's question is "does my student have a mentor", and the request card and the reconciliation link already treat the mentor link on the Students row as the assignment, so grouping on the joined report alone was answering a different question. I ran all 106 suites on the branch and they pass.

I am merging this and following it on trunk with 1.117.4, cut from the source repository so the next release push cannot overwrite it. That release carries this PR plus:

  • Administrators Dashboard, Mentors column. It counts distinct mentor names, and the name only arrives through the reports join, so a mentored student the join missed read as "1 in progress, 0 mentors, 0 waiting". A nameless assigned mentor now counts as one mentor of her own; the index carries no mentor ID.
  • One predicate. WPCPM_Roster_Index::is_waiting() is what groups() and the Administrators count both read, so the two screens cannot drift apart again. The Administrators Dashboard suite now pins the has_mentor case, which nothing pinned before.
  • Wording. The mentor cell said the report record "has not been created yet", which is untrue in exactly this case: it exists, the join missed it. It now says "has not reached this page yet". The Current note names both signals, since a row with a report record but no mentor link left on the Students row is still Current.
  • Release hygiene. Version, changelog, the translation template, and design spec 7.5, which still defined Current by the report alone.

The data fix for the reported student stands as you describe it: align her email across Students and Students Reports, or remove the duplicate Students row, and the next sync puts her hours and her mentor's name on the roster as well. 1.117.4 is built and ready to deploy.

@maciejpilarski
maciejpilarski merged commit 20d918d into trunk Sep 28, 2026
1 check passed
maciejpilarski added a commit that referenced this pull request Sep 28, 2026
…gh the email join found no report record

Follows #226 (fixes #222) with the release cut from the source repository: the one
predicate WPCPM_Roster_Index::is_waiting() read by the roster's groups() and the
Administrators Dashboard's count; the Mentors column counts an assigned mentor whose
name the reports join never brought; the mentor cell says the report record has not
reached this page rather than that it was never created; the group notes name both
signals; design specs 7.5 and the Administrators table row; the Administrators
Dashboard suite pins the has_mentor case; version, changelog, translation template.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@maciejpilarski

Copy link
Copy Markdown
Contributor

@CeliGaroe, for context on what this changes for the program team:

  • What was wrong. The Institution Dashboard only counted a student as Current when the students sync found her Students Reports record, and it finds that record by email alone. When the two tables hold different addresses for her, or her address sits on a second Students row under another institution, the match fails and she is shown as waiting for a mentor even though her mentor is assigned. Her own Student Report Card reads the report record directly, which is why it looked right there.
  • What this PR does. A mentor on the Students row now makes a student Current; only a student with neither a mentor nor a report record waits. Both dashboards read the same rule.
  • What follows it, as 1.117.4 on trunk. The Administrators Dashboard's Mentors column counts her mentor too (it used to read 0 beside her), the mentor cell says the report record "has not reached this page yet" instead of claiming it was never created, the group notes say what each group means, and the version, changelog and translation template are in step. The zip is built; deploying it to wordpresseducation.org is the next step, and [Data]: Student card is not showing right for the Institution #222 stays open until then.
  • What to do for the student now. In Airtable, make her email identical on her Students row and her Students Reports row, or delete the duplicate Students row filed under the other institution, then run the students sync. That moves her to Current today, with her hours and her mentor's name on the roster, on the version that is live.
  • How to spot the same shape elsewhere. A Current student whose mentor cell reads "A mentor is assigned. The report record has not reached this page yet." with no hours is an address mismatch between the two tables.

@CeliGaroe

Copy link
Copy Markdown
Contributor

Thank you @maciejpilarski!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Data]: Student card is not showing right for the Institution

3 participants