-
Notifications
You must be signed in to change notification settings - Fork 11
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
Remove as2 #618
Remove as2 #618
Conversation
[diff-counting] Significant lines: 63. |
Visit the preview URL for this PR (updated for commit b6be5c3): https://cornelldti-courseplan-dev--pr618-remove-as2-1wimklw8.web.app (expires Tue, 22 Mar 2022 23:59:39 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
@@ -188,7 +191,7 @@ export default defineComponent({ | |||
placeholderText, | |||
gradYear: this.onboardingData.gradYear, | |||
entranceYear: this.onboardingData.entranceYear, | |||
collegeAcronym: this.onboardingData.college ? this.onboardingData.college : '', | |||
collegeAcronym: this.onboardingData.college ?? '', |
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.
Whoa I didn't know ??
existed. This is cool!
}, | ||
majors(): Readonly<Record<string, string>> { | ||
const majors: Record<string, string> = {}; | ||
const majorJSON = reqsData.major; | ||
const acr = this.collegeAcronym.replace('AS', 'AS2'); |
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 arbitrarily choosing AS2
to replace AS
so that it passes the if statement?
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.
I think so! The major lists for AS1
and AS2
should be the same
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.
Confirmed this was the case in the index.ts
in the data folder.
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.
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.
Reviewed the code and found one small change to make. After fixing that, fixing the bug @hahnbeelee pointed out, resolving merge conflicts, and testing, this should be good for someone else to review!
}, | ||
majors(): Readonly<Record<string, string>> { | ||
const majors: Record<string, string> = {}; | ||
const majorJSON = reqsData.major; | ||
const acr = this.collegeAcronym.replace('AS', 'AS2'); |
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.
I think so! The major lists for AS1
and AS2
should be the same
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.
everything makes sense for me except the part where we're doing a special case for A&S at the end. Shouldn't we be directly changing the JSON instead?
src/utilities.ts
Outdated
@@ -50,6 +50,9 @@ export const yearRange = 6; | |||
|
|||
export function getCollegeFullName(acronym: string | undefined): string { | |||
// Return empty string if college is not in requirementJSON | |||
if (acronym === 'AS') { |
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.
should we be doing a special case here instead of changing the JSON directly?
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.
This question is totally fair, and it's due to an inconsistency with the frontend and "backend" (how we represent requirements data).
A&S before and after 2020 have different requirements. They are represented as AS1
and AS2
in our requirements data. That is, they are considered separate colleges (because we assume one college = one set of requirements). On the frontend, we want the user to see it as a merged college, i.e. AS
. So, Zak decided to implement this as a frontend-only change by writing conversions between these two representations. An upside of this is that the backend format can stay the same. A downside of this is that A&S needs to be special-cased in few different places.
An alternative implementation would have been something along the lines of adding variants to the requirements data format. So, the backend would look something like AS:Version1
and AS:Version2
, where AS
refers to a single college and Version1
and Version2
refer to different sets of requirements (we now assume one college = one or more sets of requirements). An upside would be that it would be more extensible -- that is, other colleges can have multiple versions as well (which is great if requirements are changed relatively frequently). A downside would be that every other college would have to support this added complexity (for example, EN
would need to turn into EN:Version1
or EN:Default
, both in the requirements data and in our user database). There are probably ways to avoid this downside by making the new format backwards-compatible, but that also comes with its pros and cons (see how we implemented additionalRequirements
).
I personally think a single special case like this is fine. But if there are more special cases to be added in the future, or if we somehow manage to reach the backlog, I think there should be a refactoring effort.
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.
Thanks for explaining that Ben! If we ever have a chance to refactor this to use the alternate implementation you mentioned, that could allow us to handle more specific cases of requirements changing over time (such as the Probability and Stats requirement for ECE). It's definitely down the line, but it could be useful for our users and help to reduce some confusion.
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.
Tested on preview url with entrance year before Fall 2020, Fall 2020, and after Fall 2020 and they all look good! 😄 The bug I noticed during dev meeting is when adding another major and clicking finish on the onboarding, navigating to the new added major's header doesn't display anything below it (steps and screenshots are below). It's fine after refreshing the page (progress bar + requirements show up), so I'm not sure how big of a problem this is. I tried the same steps on prod, and it seems to have expected behavior (progress bar + requirements show up after finishing edit profile w/o having to refresh).
Thank you for the detailed testing plan!! However, I still am not able to reproduce this :(
Additionally, I fixed the bug @einc pointed out during the meeting that A&S was still labeled pre-post 2020 in the reqs bar! This PR should be good to go now besides this potential bug. |
Summary
This pull request removes the AS1 and AS2 options from the onboarding college dropdown, replacing these with one "Arts and Sciences" option. Upon onboarding submission, whether the user is actually enrolled in AS1 or AS2 is determined by checking to entrance year and season the user recorded.
Test Plan
The new "Arts and Sciences" option:
Whether you're in AS1 or AS2 is inferred on onboarding submission:
NEW Confirm that an entrance year of Spring 2020 is AS before Fall 2020 (now that season is taken into account).
Future STODOs