Repository navigation
Fix Classes card evaluation option for MyAcademicHistory grade options (MA-741 - #2392
Conversation
MA-769: normalize grade_option parsing (snake_case and camelCase), map known TSS grade-option codes case-insensitively, pass unrecognized values through instead of showing Other, and hide the evaluation row when no data is present. Adds unit tests for the mapping and parsing.
There was a problem hiding this comment.
How did you come up with all the cases for the grade option?
MyAcademicHistory provides data in Title Case, not ALL CAPS.
Here's a real example of what comes from the MyAcademicHistory API: "grade_option":"Letter Grade"
Please make sure you add all the possible cases and test manually on your phone by asking me to produce a PROD-TEST build so you can see your data flowing 🫡
|
Also, the test file only shows that the code the AI wrote is good, but it doesn't reflect the real behavior (for instance, tests will break if you receive a "Letter Grade" in the response when it should be okay) |
|
Thank you for the feedback! I've reworked the mapping on this branch:
|
|
Awesome! Making a PROD-TEST build to test with real data |
|
Update from testing on a PROD-TEST build with my student account: What works: Three of four enrolled courses return Data gap found: The fourth course (CSE 021, enrolled lower-division) shows no Evaluation row at all. The raw production response shows its course-level record contains no So the defensive behavior we implemented (hide the row when the value is missing/blank) is working exactly as reviewed; the missing data is upstream of the app. Two questions for whoever owns the MyAcademicHistory integration:
Redacted structure evidence (no personal data): // sibling record
{"term_code":"FA26","subject_code":"MGT","course_level":"UD","grade_option":"Letter Grade","grade":"","course_title":"...",...}
// affected record — grade_option key absent entirely
{"term_code":"FA26","subject_code":"CSE","course_level":"LD","course_title":"Math/Algorithm&Systems Analys","enrollment_status":"Booked",...} |
klortiz13
left a comment
There was a problem hiding this comment.
Good job!! Just tested and looks good!
Summary
Fixes the Classes card and Class Schedule screen always showing "Evaluation Option: Other" after the TSS academic history migration (MA-769).
The TSS class list payload no longer reliably provides a
grade_optionvalue that matches the previousL/P/Sswitch, so the model fell through to the "Other" default even when the rest of the course data rendered correctly. This change makes evaluation-option handling resilient to the TSS payload variations:ClassData.fromJsonnow accepts bothgrade_option(snake_case) andgradeOption(camelCase), matching the mixed-case field naming already present in the TSS payload (e.g.sectionData,enrollStatus).ScheduledClass.gradeOptionnormalizes known grade-option codes case-insensitively (L/GR/GRD/LETTER→ Letter Grade,P/PN/PNP/PASS→ Pass/No Pass,S/SU/S/U→ Sat/Unsat).Changelog
[General] [Fix] - Fix Classes card evaluation option always showing "Other" by normalizing TSS grade-option data (MA-769)
Test Plan
test/core/models/scheduled_class_test.dartcovering: classicL/P/Smapping, case-insensitive TSS variants (GRD,pnp,S/U), verbatim passthrough for unknown codes, null/blank handling, and both snake_case and camelCase JSON parsing.flutter testpasses (23 tests, including 6 new).dart analyzeon the touched files reports no new issues (only pre-existing repo-wide lints).dart formatapplied to all touched files.Note for reviewers: real
grade_optionvalues could not be observed end-to-end from a staff test account (academic history returns empty enrollment data), so the mapping was built from the payload structure evidence in the TSS migration commit plus defensive handling for unknown values. Once a student account is available in the next term, the verbatim passthrough guarantees the card shows exactly what the API returns rather than masking it as "Other".