Skip to content

Change ModuleLessonConfig value to array - #3420

Merged
chrisgzf merged 13 commits into
nusmodifications:masterfrom
zhoukerrr:feat/customize-mod
Mar 19, 2023
Merged

Change ModuleLessonConfig value to array#3420
chrisgzf merged 13 commits into
nusmodifications:masterfrom
zhoukerrr:feat/customize-mod

Conversation

@zhoukerrr

Copy link
Copy Markdown
Contributor

Context

Part of #3404

Implementation

Changed the value of ModuleLessonConfig type to classNo[].
This change does not affect anything for its current functionality.
New redux actions will be added to add/remove classes to the array.
This will allow TAs to customise the module.

Other Information

The current idea is to add an extra button next to the remove and hide button of the module and allow student to add/remove classes as they click.

@vercel

vercel Bot commented Jan 1, 2023

Copy link
Copy Markdown

@Zhou-Jiahao-1998 is attempting to deploy a commit to a Personal Account owned by @nusmodifications on Vercel.

@nusmodifications first needs to authorize it.

@vercel

vercel Bot commented Jan 1, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
nusmods-export ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 19, 2023 at 1:03PM (UTC)
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 19, 2023 at 1:03PM (UTC)

@codecov

codecov Bot commented Jan 1, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.12 🎉

Comparison is base (f91c1e7) 53.07% compared to head (ce1b56e) 53.19%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3420      +/-   ##
==========================================
+ Coverage   53.07%   53.19%   +0.12%     
==========================================
  Files         271      271              
  Lines        5762     5779      +17     
  Branches     1336     1340       +4     
==========================================
+ Hits         3058     3074      +16     
- Misses       2704     2705       +1     
Impacted Files Coverage Δ
website/src/reducers/timetables.ts 87.25% <100.00%> (+1.86%) ⬆️
website/src/utils/timetables.ts 93.67% <100.00%> (+0.16%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zhoukerrr zhoukerrr changed the title Feat/customize mod Change ModuleLessonConfig value to array Jan 1, 2023

@li-kai li-kai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi! Thanks for submitting the PR, the code looks good to me.

Enabling custom removal/addition of lessons is such a powerful utility that we want to make sure users wield it right. That means we have to make it obvious which lessons were added/removed, and also the ability to undo them. The consequence of a someone missing lessons/lectures for a semester is pretty big.

As a team we just couldn't come up with a good solution. Ultimately NUSMods is more of a planner than a calendar, so we've been encouraging users customize their schedule via calendar apps instead.

Despite that, it does seem that demands for such a feature never back down. If you're keen on building it, could you propose how your TA-mode would work? Once the details are ironed out, you'll have the go-ahead.

@zhoukerrr

zhoukerrr commented Feb 5, 2023

Copy link
Copy Markdown
Contributor Author

@li-kai @chrisgzf Sorry for the delay. After some brainstorming, this is how I plan to do this for now.

UI side:

  • A new button with the setting icon will be added next to the delete/hide button for each of the modules at the bottom
  • To avoid accidental modification, a pop up window will display a warning
  • If the user chooses to proceed, the timetable will enter the state where all possible slots for that module are now selectable/removable
  • At this point, buttons next to the module below will turn into a DONE button, this will end the customisation mode
  • A special symbol/word (e.g. TA) could be placed on ALL of the slots for modules to emphasis that the module has been customised

Code side:

  • Implement the UI mentioned above
  • A new redux state that stores the modules that are customised will be added.
  • Upon entering the customisation state, classes will be added/removed from the array done in this PR

Let me know your thoughts on this approach. Feel free to share any ideas/comments that you have. Thank you!

@li-kai

li-kai commented Feb 11, 2023

Copy link
Copy Markdown
Member

On the UI, it might be better to collapse all 3 into a dropdown so we have:
- Hide All
- Delete All
- Edit Individually <- this triggers modal

But the rest of the details sound good to me. @chrisgzf do you have bandwidth to review the PRs?

@zhoukerrr

Copy link
Copy Markdown
Contributor Author

Hi @li-kai @chrisgzf, may I know if this PR can be merged first is that I can push out my next PR? I am almost done with the changes but I do not want to send in a giant PR that is difficult to review. Thank you!

@chrisgzf chrisgzf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @zhoukerrr, changes look okay to me but one more thing. Could you:

  • increment the redux-persist schema version in timetables.ts:25
  • write a migration in the same persistConfig to migrate the users' existing data to the new data shape?

This prevents this change from breaking the user's existing timetable data, which will be very messy.

@zhoukerrr
zhoukerrr requested a review from chrisgzf March 18, 2023 12:56
@zhoukerrr

Copy link
Copy Markdown
Contributor Author

@li-kai @chrisgzf Hi! May I know if this PR can be merged?

@chrisgzf chrisgzf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some last queries else LGTM

Comment thread website/src/reducers/timetables.test.ts Outdated
Comment thread website/src/reducers/timetables.test.ts
@chrisgzf
chrisgzf merged commit 50adbe0 into nusmodifications:master Mar 19, 2023
chrisgzf added a commit that referenced this pull request May 7, 2023
chrisgzf added a commit that referenced this pull request May 24, 2023
* Revert "Add support for Timetable for TAs (#3434)"

This reverts commit 7f581df.

* Revert "Change ModuleLessonConfig value to array (#3420)"

This reverts commit 50adbe0.

* Add scraper additional information

* Fix type definitions for module

* Show additional information on frontend

* Fix test fixtures
zwliew pushed a commit that referenced this pull request Aug 4, 2023
* feat: update lesson to array

* chore: fix lint

* fix: update test cases

* chore: format lint

* chore: update test cases

* feat: update timetable redux schema

* feat: fix lint

* chore: fix lint

* chore: add timetable schema migration test

* fix: add comment for test version

---------

Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
zwliew pushed a commit that referenced this pull request Aug 10, 2023
* feat: update lesson to array

* chore: fix lint

* fix: update test cases

* chore: format lint

* chore: update test cases

* feat: update timetable redux schema

* feat: fix lint

* chore: fix lint

* chore: add timetable schema migration test

* fix: add comment for test version

---------

Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
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.

3 participants