-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add terms to custom events #1098
base: main
Are you sure you want to change the base?
Conversation
@MinhxNguyen7 Hi! Could you review this pull request when you have a moment? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright on the front-end with a minor suggestion.
However, you need to implement the backend to save it as well. For that, you need to add the term to the DB schema and save/get it from the backend endpoints. You can find the custom event schema in apps/backend/src/db/schema/schedule/custom_event.ts
. For saving and retrieving, edit getGuestUserData
and upsertGetUserData
. There's not that much to change, but you'll need to read the code to see what has already been inferred when you changed RepeatingCustomEventSchema
. Let me know if you need help with that.
That highlights the fact that the test plan above needs to account for saving and loading user account as well.
apps/antalmanac/src/components/Calendar/Toolbar/CustomEventDialog/CustomEventDialog.tsx
Outdated
Show resolved
Hide resolved
Thanks for the feedback! I’ve made the changes on the frontend as suggested and also tried to adapt the backend by adding the term to the DB schema and updating the relevant endpoints (getGuestUserData and upsertGuestUserData). However, I’m having trouble running the backend locally to verify if the migration with the new field works correctly. This is my first time working with tRPC, so I’m not entirely sure how to properly set up my local environment for the backend. Could you either check the changes on your side or provide a detailed explanation of how to configure the backend locally to ensure everything works as expected? Thanks in advance! |
I'll check the changes on my side, and I'm working on updating the README to reflect our stack after a recent migration. Sorry for the inconvenience. I didn't think about this when I marked the issue as a good first task. |
Summary
The change addresses the issue of assigning a term to a custom event when it is created. Previously, when users created custom events, no term was assigned to them. With this update, we now ensure that each custom event is associated with a term.
The term is obtained from the associated ScheduleCourse in the schedule. If the schedule contains classes from multiple terms (e.g., Fall 2023 and Spring 2023), the latest term is selected. If no term is found in the schedule, the default term will be used.
Test Plan
Issues
Closes #762