Skip to content

Fix Classes card evaluation option for MyAcademicHistory grade options (MA-741 - #2392

Merged
klortiz13 merged 2 commits into
devfrom
classes-card-evaluation-option
Nov 13, 2026
Merged

klortiz13 merged 2 commits into
devfrom
classes-card-evaluation-option

Conversation

@CoGibby

@CoGibby CoGibby commented Nov 3, 2026

Copy link
Copy Markdown

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_option value that matches the previous L/P/S switch, 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.fromJson now accepts both grade_option (snake_case) and gradeOption (camelCase), matching the mixed-case field naming already present in the TSS payload (e.g. sectionData, enrollStatus).
  • ScheduledClass.gradeOption normalizes 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).
  • Unrecognized non-empty values are passed through verbatim instead of being silently replaced with "Other", so any new TSS code surfaces the real data for review.
  • Missing, null, or blank values return null, and both the Classes card and the Class Schedule detail rows hide the evaluation row rather than showing a misleading "Other".

Changelog

[General] [Fix] - Fix Classes card evaluation option always showing "Other" by normalizing TSS grade-option data (MA-769)

Test Plan

  • Added test/core/models/scheduled_class_test.dart covering: classic L/P/S mapping, 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 test passes (23 tests, including 6 new).
  • dart analyze on the touched files reports no new issues (only pre-existing repo-wide lints).
  • dart format applied to all touched files.

Note for reviewers: real grade_option values 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".

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.

@klortiz13 klortiz13 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.

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 🫡

@klortiz13

Copy link
Copy Markdown
Contributor

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)

@CoGibby

CoGibby commented Nov 6, 2026 •

Copy link
Copy Markdown
Author

Thank you for the feedback! I've reworked the mapping on this branch:

  • Title Case values now map directly: "grade_option":"Letter Grade" → Letter Grade, Pass/No Pass → Pass/No Pass (matching your real payload example).
  • Matching is case-insensitive, so casing drift can't silently break it.
  • The graduate S/U option accepts both Sat/Unsat and the registrar-official Satisfactory/Unsatisfactory, and displays Sat/Unsat to stay consistent with the existing UI strings (verified against UCSD's official grading system docs: undergrad Letter Grade and Pass/No Pass; grad Satisfactory/Unsatisfactory).
  • The legacy L/P/S single-letter codes still map for older payloads.
  • Unknown values still pass through verbatim; missing/blank still hides the Evaluation row instead of showing "Other".

@CoGibby CoGibby changed the title Fix Classes card evaluation option for TSS data (MA-769) Fix Classes card evaluation option for MyAcademicHistory grade options (MA-741 Nov 6, 2026
@klortiz13
klortiz13 self-requested a review November 7, 2026 00:38
@klortiz13

Copy link
Copy Markdown
Contributor

Awesome! Making a PROD-TEST build to test with real data

@CoGibby

CoGibby commented Nov 7, 2026 •

Copy link
Copy Markdown
Author

Update from testing on a PROD-TEST build with my student account:

What works: Three of four enrolled courses return "grade_option":"Letter Grade" from the production MyAcademicHistory endpoint and now render "Evaluation: Letter Grade" on both the Classes card and Class Schedule rows. This also addresses the earlier test-plan comment — real payloads use full-string values like Letter Grade, which map directly (and case-insensitively).

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 grade_option key whatsoever — the JSON goes directly from "course_level":"LD" to "course_title" — while sibling course records include "grade_option":"Letter Grade". The sectionData entries contain no grade information under any other key (schema is identical across all courses).

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:

  1. Should grade_option always be populated for enrolled records? This record was booked in early August during first-year enrollment, so the registrar may not have had a grading basis captured at booking time — but the student did select a grading option, so a sync/population gap seems likely.
  2. If the field can legitimately be absent, is hiding the row the desired UX, or should the app show something like "Evaluation: Unavailable"? I can ask UI/UX personnel if needed.

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 klortiz13 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.

Good job!! Just tested and looks good!

@klortiz13
klortiz13 changed the base branch from experimental to dev November 13, 2026 22:22
@klortiz13
klortiz13 merged commit 6a72f61 into dev Nov 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants