Skip to content
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

Pcp schedule sharing - frontend+backend #486

Merged
merged 120 commits into from
Oct 19, 2023

Conversation

mialana
Copy link
Contributor

@mialana mialana commented Apr 14, 2023

No description provided.

@andyjiang3 andyjiang3 changed the title Pcp schedule sharing frontend Pcp schedule sharing - frontend+backend Sep 5, 2023
Copy link
Member

@andyjiang3 andyjiang3 left a comment

Choose a reason for hiding this comment

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

Nice work! Thanks for also refactoring / removing locally storing schedule data - left some comments on refactoring and naming for code readability. Besides from that, we just need to:

  1. Throughly test schedule sharing - approving requests doesn't seem to be working for me locally (giving me 409 error).
    • Viewing friends schedule: no courses added to their schedule, not sharing a schedule
    • Loading friends schedule
  2. Test schedule / cart changes syncing with backend - ex. add courses to cart, log out, and make sure its up-to-date after logging in, edge cases: cart, semester, new acc (cart, "Schedule")??
  3. @mialana can you add a few sentence to the PR describing the changes to backend-frontend syncing / locally storing some schedule data on the frontend for future reference?

backend/tests/plan/test_primary_schedules.py Outdated Show resolved Hide resolved
backend/tests/plan/test_primary_schedules.py Show resolved Hide resolved
frontend/plan/pages/index.tsx Outdated Show resolved Hide resolved

interface AddScheduleFriendsModalInteriorProps {
user: User;
existingData: string[] | User[];
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a Friends type, defined as User[]

// hash every section to a color, but if that color is taken, try the next color in the
// colors array. Only start reusing colors when all the colors are used.
const getColor = (() => {
const colors = [
Copy link
Member

Choose a reason for hiding this comment

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

move to utils

frontend/plan/actions/index.js Outdated Show resolved Hide resolved
delete newSchedule.id;
return newSchedule;
readOnly: false,
primaryScheduleId: "-1",
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason why primaryScheduleId is a string?

newState.deletedSchedules.reduce(
(acc, schedule) => acc || schedule === scheduleFromBackend.name,
false
)
Copy link
Member

Choose a reason for hiding this comment

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

find

foundSchedule.pushedToBackend &&
cloudUpdated >= foundSchedule.updated_at &&
foundSchedule.updated_at - cloudUpdated >=
MIN_TIME_DIFFERENCE)
Copy link
Member

Choose a reason for hiding this comment

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

foundSchedule.updated_at - cloudUpdated would always be negative and thus this if statement would always be false?

@andyjiang3
Copy link
Member

andyjiang3 commented Oct 13, 2023

TODO: @anshnagwekar @andyjiang3 remove reverse_func in doc_settings and potentially other places
edit: DONE

@mialana
Copy link
Contributor Author

mialana commented Oct 17, 2023

Primary updates:

  • State changes are now done directly on backend and then updated accordingly on frontend.
  • Redux logic added for friendship states (i.e. reducers and actions).

@andyjiang3 andyjiang3 merged commit 64508b7 into master Oct 19, 2023
11 checks passed
@andyjiang3 andyjiang3 deleted the pcp-schedule-sharing-frontend branch October 19, 2023 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

8 participants