Skip to content

Fix "Only my PhD advisees" filter on view-project-people (#1325)#1326

Merged
jonfroehlich merged 2 commits into
masterfrom
1325-fix-phd-advisees-filter
Jun 18, 2026
Merged

Fix "Only my PhD advisees" filter on view-project-people (#1325)#1326
jonfroehlich merged 2 commits into
masterfrom
1325-fix-phd-advisees-filter

Conversation

@jonfroehlich

@jonfroehlich jonfroehlich commented Jun 17, 2026

Copy link
Copy Markdown
Member

Fixes #1325.

Problem

The "Only my PhD advisees" toggle on the internal /view-project-people/ page showed no advisees (only Mikey Saugstad, via a pre-existing hardcoded template special-case).

Root cause

The #1284 refactor resolved the lab director with:

director = Person.objects.filter(position__title=Title.DIRECTOR).distinct().first()

But Jon holds a professor title, not a Title.DIRECTOR position (get_prof_titles() excludes DIRECTOR; PhD students' advisor FK points to Jon, which requires a professor title). So the lookup matched nobody → director was None_build_phd_advisee_ids() returned an empty set → every is_phd_advisee was false. The existing tests passed only because they fabricated the director with a Title.DIRECTOR position — baking in the wrong assumption.

Fix

The Makeability Lab has exactly one director/founder for its lifetime (Jon Froehlich), so identify him by name in one canonical place:

  • Person.DIRECTOR_NAME + Person.get_director() — single source of truth.
  • view_project_people uses Person.get_director(); both the is_director flag and the advisee check derive from it, so they can't disagree.
  • website/admin/utils.py reads the same Person.DIRECTOR_NAME constant, removing a second independent hardcoding of the name.
  • Tests: added a regression test reproducing the production scenario (director holds a professor title, other professors exist); updated the two tests that fabricated a Title.DIRECTOR director to use the canonical director.

Testing

  • python manage.py test website --settings=makeabilitylab.settings_test → all 212 tests pass.
  • The new regression test fails on the pre-fix code (False is not true) and passes with the fix.

Notes

  • No UI/markup change, so no a11y impact; the JSON payload contract is unchanged.
  • The template's person.last_name === 'Saugstad' special-case is intentional and is now documented in place (it predates this bug): Mikey was Jon's MS student at UMD, chose not to pursue a PhD, and has since been the primary/only lead engineer on Project Sidewalk, so he's included in the acknowledgment view despite not being a PhD advisee by the formal rule.

🤖 Generated with Claude Code

jonfroehlich and others added 2 commits June 17, 2026 16:09
…ter works (#1325)

The "Only my PhD advisees" filter showed no advisees. The #1284 refactor
resolved the lab director via a Title.DIRECTOR position, but Jon holds a
professor title (not a "Director" position), so the lookup matched nobody,
director was None, and every is_phd_advisee was false.

The lab has exactly one director/founder for its lifetime, so identify him
by name in one canonical place:

- Add Person.DIRECTOR_NAME + Person.get_director() as the single source of
  truth; the view's is_director flag and advisee check both derive from it.
- Point website/admin/utils.get_active_professors_queryset() at the same
  constant, removing a second independent hardcoding of the name.
- Add a regression test reproducing the production scenario (director holds
  a professor title); update the two tests that fabricated a Title.DIRECTOR
  director to use the canonical director.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The "Only my PhD advisees" filter includes `last_name === 'Saugstad'`
explicitly. Document why so it isn't mistaken for a bug: Mikey was Jon's
MS student at UMD, chose not to pursue a PhD, and has since been the
primary lead engineer on Project Sidewalk, so he's included in the
acknowledgment view despite not being a PhD advisee by the formal rule.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jonfroehlich jonfroehlich merged commit e6b1db2 into master Jun 18, 2026
2 checks passed
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.

"Only my PhD advisees" filter on view-project-people shows no advisees

1 participant