-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mentors professionalExperience field, ensure mentee provides requ…
…ired information to display list of mentors
- Loading branch information
1 parent
6f07152
commit 84d0034
Showing
5 changed files
with
47 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
import { RedProfile } from '@talent-connect/shared-types' | ||
|
||
export function toggleValueInArray<T>(array: Array<T>, value: T) { | ||
if (array.includes(value)) return array.filter((val) => val !== value) | ||
else return [...array, value] | ||
} | ||
|
||
// Fix for newly registered mentee users: | ||
// Ensuring that a mentee filled their profile with required information before displaying list of mentors | ||
const isString = (value: any) => typeof value === 'string' | ||
const isFulfilledString = (string: any) => isString(string) && string.length > 0 | ||
|
||
const arrayIsNotEmpty = (array: any) => Array.isArray(array) && array.length > 0 | ||
const isObjectValueFulfilled = (objectValue: any) => arrayIsNotEmpty(objectValue) || isFulfilledString(objectValue) | ||
|
||
export const ensureMenteeProfileIsComplete = ({ mentee_mentoringGoal, mentee_primaryRole_fieldOfExpertise }: RedProfile) => { | ||
const isMenteeProfileComplete = isObjectValueFulfilled(mentee_mentoringGoal) && isObjectValueFulfilled(mentee_primaryRole_fieldOfExpertise) | ||
return isMenteeProfileComplete | ||
} |