feat: implement CourseRepository.getCourseTable#170
Open
Conversation
PR Preview BuildsBuild Number: 619 Deploy
Android (Firebase App Distribution) |
pan93412
approved these changes
Mar 6, 2026
e6acf72 to
2142775
Compare
e375e88 to
d6acd50
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Implements CourseRepository.getCourseTable end-to-end: fetches the course table from the network, persists course/offering/teacher/class/classroom/schedule data into Drift in a transaction, and returns a UI-ready CourseTableData map with TTL-based caching.
Changes:
- Add TTL caching for course tables via
fetchWithTtland a newSemesters.courseTableFetchedAttimestamp. - Persist course table data into Drift with new upsert helpers in
DatabaseActionsand cascade deletes for dependent offering rows. - Extend DB schema/view to support bilingual names (
Courses.nameEn,Classes.nameEn) and avoid Drift column name disambiguation inCourseTableSlots.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/repositories/course_repository.dart | Implements getCourseTable, network fetch + DB persistence, and course-table grid assembly with span calculation |
| lib/database/actions.dart | Adds upsert helpers for course-related entities used by the repository transaction |
| lib/database/schema.dart | Adds courseTableFetchedAt, Classes.nameEn, makes some offering fields nullable, and adds cascade deletes |
| lib/database/views.dart | Updates CourseTableSlots view (semester column + classroom name alias) to support repository queries |
| lib/database/database.g.dart | Regenerated Drift output reflecting schema/view changes |
| AGENTS.md | Updates project status documentation to reflect implemented repository methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bradly0cjw
previously approved these changes
Mar 10, 2026
Categorize all nullable fields on Fetchable tables as either non-Fetchable (populated during initial fetch) or Fetchable (populated during detail fetch). Fix nullability for Courses.nameZh (always present), CourseOfferings.phase and courseType. Reorder zh/en fields consistently. Add syllabusRemarks for teacher-authored syllabus notes distinct from system-generated course table remarks.
Fetch course table DTOs via auth, upsert courses, teachers, classrooms, classes, and course offerings into the database, then query the CourseTableSlots view to build CourseTableData with span computation. Also adds nameEn to Classes schema, upsert helpers in DatabaseActions, semester filter to CourseTableSlots view, and Expression getter to avoid Drift's nameZh1 auto-disambiguation.
d6acd50 to
4085031
Compare
Dokploy Preview Deployment
|
5 tasks
Fixes incorrect span merging for numberless entries (e.g. 班週會) where null == null would merge unrelated courses. Also fixes stale snapshot reads by tracking consumed slots in a separate set.
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.
Summary
CourseRepository.getCourseTablewith full DB persistence: upserts courses, teachers, classrooms, classes, offerings, junctions, and schedules in a single transactionfetchWithTtlwith a newSemesters.courseTableFetchedAttimestampDatabaseActionsfor all course-related entitiesExpressiongetter inCourseTableSlotsview to aliasclassrooms.nameZhasclassroomNameZh(avoids Drift'snameZh1auto-disambiguation)nameEntoClassesschema for English class namesCourseOfferings.phaseandcourseTypenullable (phase not always present, courseType populated later from syllabus)CourseOfferingFK references for clean stale offering removalFetchablefield categorization withNot a [Fetchable] fieldcommentsTest plan
getCourseTablereturns correct course data for a logged-in userrefresh: truebypasses TTL and fetches fresh data