Skip to content

Commit

Permalink
Move AS check to utilities to return in all locations
Browse files Browse the repository at this point in the history
  • Loading branch information
willespencer committed Mar 15, 2022
1 parent af71832 commit b6be5c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/components/Requirements/RequirementHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}"
class="college-title-top"
>
{{ getCollegeFullName(collegeAcronym) }}
{{ getCollegeFullName(onboardingData.college) }}
</p>
</button>
</div>
Expand Down Expand Up @@ -213,11 +213,6 @@ export default defineComponent({
},
},
computed: {
// get college acronym, but special case for A&S to be switched from AS1/AS2 to just AS
collegeAcronym(): string {
const acronym = this.onboardingData.college ?? '';
return acronym.includes('AS') ? 'AS' : acronym;
},
// number of fully fulfilled requirements, note pure self-checks are never fulfilled
requirementFulfilled(): number {
let fulfilled = 0;
Expand Down
6 changes: 4 additions & 2 deletions src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ export function getCurrentYear(): number {
export const yearRange = 6;

export function getCollegeFullName(acronym: string | undefined): string {
// Return empty string if college is not in requirementJSON
if (acronym === 'AS') {
// return Arts and Sciences for AS, AS1, or AS2
if (acronym && acronym.startsWith('AS')) {
return 'Arts and Sciences';
}
const college = acronym ? requirementJSON.college[acronym] : null;

// Return empty string if college is not in requirementJSON
return college ? college.name : '';
}

Expand Down

0 comments on commit b6be5c3

Please sign in to comment.