Skip to content

Commit

Permalink
#2831 - Update student gender options (#3401)
Browse files Browse the repository at this point in the history
Update student gender options.
  • Loading branch information
katrina-aot-git authored Jun 13, 2024
1 parent 6f5c263 commit 23accef
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe("StudentAccountApplicationAESTController(e2e)-approveStudentAccountAppl
mode: "aest-account-approval",
identityProvider: "bceidboth",
sinConsent: true,
gender: "X",
gender: "nonBinary",
addressLine1: "address 1",
city: "Victoria",
country: "Canada",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function createFakeStudent(user?: User): Student {
const student = new Student();
student.user = user ?? createFakeUser();
student.birthDate = faker.date.past(18).toISOString();
student.gender = "X";
student.gender = "nonBinary";
student.contactInfo = {
address: {
addressLine1: faker.address.streetAddress(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
import { getSQLFileData } from "../utilities/sqlLoader";

export class UpdateGenderOptions1718050524263 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
getSQLFileData("Update-gender-options.sql", "Student"),
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
getSQLFileData("Rollback-update-gender-options.sql", "Student"),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
UPDATE
sims.students
SET
gender = 'male'
WHERE
gender = 'man';

UPDATE
sims.students
SET
gender = 'diverse'
WHERE
gender = 'nonBinary';

UPDATE
sims.students
SET
gender = 'female'
WHERE
gender = 'woman';

UPDATE
sims.students
SET
gender = 'unknown'
WHERE
gender = 'preferNotToAnswer';

ALTER TABLE
sims.students
ALTER COLUMN
gender TYPE varchar(10);
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ALTER TABLE
sims.students
ALTER COLUMN
gender TYPE varchar(50);

UPDATE
sims.students
SET
gender = 'man'
WHERE
gender = 'male';

UPDATE
sims.students
SET
gender = 'nonBinary'
WHERE
gender = 'X';

UPDATE
sims.students
SET
gender = 'nonBinary'
WHERE
gender = 'diverse';

UPDATE
sims.students
SET
gender = 'woman'
WHERE
gender = 'female';

UPDATE
sims.students
SET
gender = 'preferNotToAnswer'
WHERE
gender = 'unknown';
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe(
`2000000001000900000000PABCD19950630${processDateFormatted}Doe John MMAddress Line 1 Address Line 2 Calgary AB H1H 1H1 Canada [email protected] PT `,
);
expect(msfaaPartTimeOtherCountry).toBe(
`2000000001001900000001PEFDG20000101${processDateFormatted}Other Doe Jane OSAddress Line 1 Some city on United State United States [email protected] PT `,
`2000000001001900000001PEFDG20000101${processDateFormatted}Other Doe Jane SAddress Line 1 Some city on United State United States [email protected] PT `,
);
expect(msfaaPartTimeRelationshipOther).toBe(
`2000000001002900000002PIHKL20011231${processDateFormatted}Other Doe Other John FOAddress Line 1 Address Line 2 Victoria BC H1H 1H1 Canada [email protected] PT `,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const MSFAA_PART_TIME_MARRIED: MSFAATestInputData = {
birthDate: "1995-06-30",
surname: "Doe",
givenName: "John",
gender: "male",
gender: "man",
maritalStatus: RelationshipStatus.Married,
addressLine1: "Address Line 1",
addressLine2: "Address Line 2",
Expand All @@ -56,7 +56,7 @@ export const MSFAA_PART_TIME_OTHER_COUNTRY: MSFAATestInputData = {
birthDate: "2000-01-01",
surname: "Other Doe",
givenName: "Jane",
gender: "unknown",
gender: "preferNotToAnswer",
maritalStatus: RelationshipStatus.Single,
addressLine1: "Address Line 1",
addressLine2: undefined,
Expand All @@ -76,7 +76,7 @@ export const MSFAA_PART_TIME_RELATIONSHIP_OTHER: MSFAATestInputData = {
birthDate: "2001-12-31",
surname: "Other Doe",
givenName: "Other John",
gender: "female",
gender: "woman",
maritalStatus: RelationshipStatus.Other,
addressLine1: "Address Line 1",
addressLine2: "Address Line 2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("ECertFullTimeIntegrationService-createRequestContent", () => {
provinceState: "BC",
postalCode: "V1V1V1",
email: "[email protected]",
gender: "male",
gender: "man",
calculatedPDPPDStatus: true,
maritalStatus: RelationshipStatus.Other,
studentNumber: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class ECertFullTimeFileRecord extends ECertFileRecord {
*/
postalCode?: string;
/**
* Student gender M=Male F=Female.
* Gender (M=man, F=woman, X=nonBinary empty=preferNotToAnswer).
*/
gender: string;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("ECertPartTimeIntegrationService-createRequestContent", () => {
provinceState: "BC",
postalCode: "V1V1V1",
email: "[email protected]",
gender: "male",
gender: "man",
calculatedPDPPDStatus: true,
maritalStatus: RelationshipStatus.Other,
studentNumber: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class ECertPartTimeFileRecord extends ECertFileRecord {
*/
postalCode?: string;
/**
* Student gender M=Male F=Female.
* Gender (M=man, F=woman, X=nonBinary empty=preferNotToAnswer).
*/
gender: string;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class SINValidationFileRequest implements FixedFormatFileLine {
*/
lastName: string;
/**
* Gender (M=Male, F=Female, O=Other).
* Gender (M=man, F=woman, X=nonBinary empty=preferNotToAnswer).
*/
gender: string;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function createFakeStudent(
student.birthDate =
options?.initialValue?.birthDate ??
getISODateOnlyString(faker.date.past(18));
student.gender = "X";
student.gender = "nonBinary";
student.contactInfo = options?.initialValue?.contactInfo ?? {
address: {
addressLine1: faker.address.streetAddress(),
Expand Down
12 changes: 9 additions & 3 deletions sources/packages/backend/libs/utilities/src/esdc-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ export function getMaritalStatusCode(
* Gets the gender code conversion for the ESDC request files.
*/
export function getGenderCode(gender: string): string {
if (gender === "male") {
return "M";
switch (gender) {
case "man":
return "M";
case "woman":
return "F";
case "nonBinary":
return "X";
default:
return "";
}
return gender === "female" ? "F" : "O";
}

/**
Expand Down
16 changes: 8 additions & 8 deletions sources/packages/forms/src/form-definitions/studentprofile.json
Original file line number Diff line number Diff line change
Expand Up @@ -1502,20 +1502,20 @@
"data": {
"values": [
{
"label": "Male",
"value": "male"
"label": "Man",
"value": "man"
},
{
"label": "Female",
"value": "female"
"label": "Non-Binary",
"value": "nonBinary"
},
{
"label": "Unknown",
"value": "unknown"
"label": "Woman",
"value": "woman"
},
{
"value": "diverse",
"label": "Diverse"
"label": "Prefer not to answer",
"value": "preferNotToAnswer"
}
],
"json": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const APPLICATION_SUBMISSION_PAYLOAD = {
studentHomeAddress: "123 Humboldt St, Victoria, BC, V9V1V1, canada",
studentEmail: "[email protected]",
studentLastName: "FRANKY",
studentGender: "male",
studentGender: "man",
studentPhoneNumber: "7789221234",
disabilityStatus: "Requested",
studentInfoConfirmed: true,
Expand Down

0 comments on commit 23accef

Please sign in to comment.