Fix "Only my PhD advisees" filter on view-project-people (#1325)#1326
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
But Jon holds a professor title, not a
Title.DIRECTORposition (get_prof_titles()excludesDIRECTOR; PhD students'advisorFK points to Jon, which requires a professor title). So the lookup matched nobody →directorwasNone→_build_phd_advisee_ids()returned an empty set → everyis_phd_adviseewasfalse. The existing tests passed only because they fabricated the director with aTitle.DIRECTORposition — 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_peopleusesPerson.get_director(); both theis_directorflag and the advisee check derive from it, so they can't disagree.website/admin/utils.pyreads the samePerson.DIRECTOR_NAMEconstant, removing a second independent hardcoding of the name.Title.DIRECTORdirector to use the canonical director.Testing
python manage.py test website --settings=makeabilitylab.settings_test→ all 212 tests pass.False is not true) and passes with the fix.Notes
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