-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
Conversation
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.
Minor suggestions & type-related questions!
if (filterData.selectedAttrs) { | ||
for (const code of Object.keys(filterData.selectedAttrs)) { | ||
if (filterData.selectedAttrs[code]) { | ||
selectedAttrs = true; | ||
break; | ||
} | ||
} | ||
} |
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.
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 |
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.
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!
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.
2 reasons
- blindly following the conventions of the rest of this file (it was probably written before union types?)
- easier to guarantee exhaustive matching (?)
I'm not a typescript expert, so I'll defer to you
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: