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

Add attributes filter to PCP #560

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add attributes filter to PCP #560

wants to merge 5 commits into from

Conversation

AaDalal
Copy link
Contributor

@AaDalal AaDalal commented Dec 23, 2023

This PR adds support for course attributes to PCP, including an attribute filter and adding attributes to course details. Attributes include those Wharton, SEAS, SAS, and Nursing, as well as additional ones for GSE, LPS, Grade Mode etc.

TODO:

  • fix issue of page overflowing when there are many attributes available
  • fix attributes selection dropdown auto closing after selection

@AaDalal AaDalal requested review from esinx and removed request for andyjiang3 January 27, 2024 22:09
Copy link
Member

@esinx esinx left a comment

Choose a reason for hiding this comment

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

Minor suggestions & type-related questions!

if (filterData.selectedAttrs) {
for (const code of Object.keys(filterData.selectedAttrs)) {
if (filterData.selectedAttrs[code]) {
selectedAttrs = true;
break;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

We could possibly make this a bit simpler by using .some method!
filterData.selectedAttrs && Object.values(filterData.selectedAttrs).some(selected => selected)

GSE = "GSE",
LAW = "LAW",
MEDICINE = "MED",
GRADE_MODE = "MODE", // this isn't really a school, but it's used for course attributes
Copy link
Member

Choose a reason for hiding this comment

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

Is this something we could split using union types? or is it better left as a one-off? Would love to hear more background behind this decision!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

2 reasons

  1. blindly following the conventions of the rest of this file (it was probably written before union types?)
  2. easier to guarantee exhaustive matching (?)

I'm not a typescript expert, so I'll defer to you

frontend/plan/types.ts Show resolved Hide resolved
@AaDalal AaDalal requested a review from esinx January 28, 2024 04:52
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.

2 participants