Skip to content

refactor(data): Remove UserProgress redundancy by making Lesson state the source of truth#48

Open
Gowreesh-A-M wants to merge 4 commits intomainfrom
refactor/merge-user-progress
Open

refactor(data): Remove UserProgress redundancy by making Lesson state the source of truth#48
Gowreesh-A-M wants to merge 4 commits intomainfrom
refactor/merge-user-progress

Conversation

@Gowreesh-A-M
Copy link
Copy Markdown
Collaborator

@Gowreesh-A-M Gowreesh-A-M commented Mar 25, 2026

  • The previous progress architecture split one logical concept (a learner’s lesson state) across two models (Lesson + UserProgress).
  • That split forced unnecessary data stitching from API → DB → UI, increased boilerplate, and created sync risk between status and progress fields.
  • This refactor aligns persistence with the backend’s flat lesson payload and our current single-user local model, so progress is read and updated from one source of truth.
  • The intent is to reduce architectural overhead now, improve consistency in resume/recent-activity flows, and make future progress metrics easier to evolve without duplicating data paths.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the application's data layer by merging user progress tracking directly into the lessons table. The primary goal is to simplify the data architecture, reduce redundancy, and improve consistency by making the LessonsTable the single source of truth for all lesson-related information, including user progress. This change streamlines how lesson data and progress are managed and accessed throughout the application, leading to a more efficient and maintainable codebase.

Highlights

  • Data Model Consolidation: Merged the UserProgressTable directly into the LessonsTable, eliminating a redundant table and simplifying the database schema. This change centralizes all lesson-specific user progress data within a single entity.
  • Schema Migration: Incremented the database schema version to 7 and implemented a migration step to safely add new percentComplete and lastAccessedAt columns to the lessons_table.
  • Centralized Progress Logic: Consolidated all lesson progress tracking logic into the CourseRepository, removing the separate UserRepository and its associated DTOs and providers. This streamlines data access and manipulation for lesson progress.
  • API Alignment and UI Simplification: Updated LessonDto to include lastAccessedAt and percentComplete, aligning the local data model with the backend API's flat structure. The recentActivityProvider was refactored to directly query the LessonsTable, simplifying UI data fetching.
  • Codebase Cleanup: Removed numerous files related to the deprecated UserProgressTable, UserProgressDto, and UserRepository, reducing overall code complexity and maintenance overhead.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Gowreesh-A-M Gowreesh-A-M changed the title refactor(data): merge user progress tracking into lessons table refactor(data): Merge user progress tracking into lessons table Mar 25, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request consolidates user progress tracking by merging percentComplete and lastAccessedAt directly into the LessonsTable, eliminating the need for a separate UserProgressTable and UserRepository. The changes include updating the database schema, DTOs, and repositories, as well as refactoring the recentActivityProvider to query the LessonsTable directly. A review comment highlighted a type safety concern in the database migration helper function, suggesting to use GeneratedColumn instead of dynamic for the column parameter.

@Gowreesh-A-M Gowreesh-A-M force-pushed the refactor/merge-user-progress branch from 42eb880 to ad46f0e Compare March 27, 2026 05:33
Merged redundant UserProgressTable into LessonsTable to simplify architecture. Updated schema to version 7 and consolidated all progress logic into CourseRepository.
- Regenerate auth_provider.g.dart to fix duplicate symbol errors.
- Remove references to the deleted user_progress repository.
- Update MockDataSource to match the simplified LessonDto schema.
@syed-tp syed-tp force-pushed the refactor/merge-user-progress branch from ad46f0e to 9e7d979 Compare March 30, 2026 06:39
…re_storage, image_picker_ios, and package_info_plus
@syed-tp syed-tp changed the title refactor(data): Merge user progress tracking into lessons table refactor(data): Remove UserProgress redundancy by making Lesson state the source of truth Mar 30, 2026
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.

2 participants