Skip to content

Commit

Permalink
Merge pull request #1833 from bcgov/fix/edx-2814-2
Browse files Browse the repository at this point in the history
Create special handling of Inclusive Ed & Career dupe resolution
  • Loading branch information
arcshiftsolutions authored Aug 13, 2024
2 parents 805ef9e + 0df3d83 commit 66f78a7
Showing 1 changed file with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@
<v-radio
:id="`index`"
:label="prog?.studentOne?.schoolName"
:value="{dupeCode: prog?.code[0], studentId: prog?.studentOne?.sdcSchoolCollectionStudentID}"
:value="{dupeCode: prog?.code, studentId: prog?.studentOne?.sdcSchoolCollectionStudentID}"
/>
<v-radio
:id="`index`"
:label="prog?.studentTwo?.schoolName"
:value="{dupeCode: prog?.code[1], studentId: prog?.studentTwo?.sdcSchoolCollectionStudentID}"
:value="{dupeCode: prog?.code, studentId: prog?.studentTwo?.sdcSchoolCollectionStudentID}"
/>
</v-radio-group>
</div>
Expand Down Expand Up @@ -225,44 +225,39 @@ export default {
},
updateStudentObject(valueToBeRemoved, studentId) {
let studentToBeUpdated = this.duplicateStudents.find(student => student.sdcSchoolCollectionStudentID === studentId);
let updateEnrolledPrograms = studentToBeUpdated.enrolledProgramCodes.match(/.{1,2}/g).filter(value => !value.includes(valueToBeRemoved));
studentToBeUpdated.enrolledProgramCodes = updateEnrolledPrograms.join('');
if(this.selectedProgramDuplicate?.programDuplicateTypeCode === 'SPECIAL_ED') {
if(this.selectedProgramDuplicate?.programDuplicateTypeCode === 'SPECIAL_ED'){
studentToBeUpdated.specialEducationCategoryCode = null;
} else if(this.selectedProgramDuplicate?.programDuplicateTypeCode === 'CAREER') {
} else if(this.selectedProgramDuplicate?.programDuplicateTypeCode === 'CAREER'){
studentToBeUpdated.careerProgramCode = null;
let updateEnrolledPrograms = studentToBeUpdated.enrolledProgramCodes.match(/.{1,2}/g).filter(value => !enrolledProgram.CAREER_ENROLLED_PROGRAM_CODES.includes(value));
studentToBeUpdated.enrolledProgramCodes = updateEnrolledPrograms.join('');
} else {
let updateEnrolledPrograms = studentToBeUpdated.enrolledProgramCodes.match(/.{1,2}/g).filter(value => !value.includes(valueToBeRemoved));
studentToBeUpdated.enrolledProgramCodes = updateEnrolledPrograms.join('');
}
},
getDuplicatePrograms() {
let programs = [];
if(this.selectedProgramDuplicate?.programDuplicateTypeCode === 'SPECIAL_ED') {
let specEdProg1Description = sdcCollectionStore().specialEducationCodesMap.get(this.sdcStudentOneDetailCopy.specialEducationCategoryCode) ? `
${sdcCollectionStore().specialEducationCodesMap.get(this.sdcStudentOneDetailCopy.specialEducationCategoryCode)?.specialEducationCategoryCode} - ${sdcCollectionStore().specialEducationCodesMap.get(this.sdcStudentOneDetailCopy.specialEducationCategoryCode)?.description}` : this.sdcStudentOneDetailCopy.specialEducationCategoryCode;
let specEdProg2Description = sdcCollectionStore().specialEducationCodesMap.get(this.sdcStudentTwoDetailCopy.specialEducationCategoryCode) ? `
${sdcCollectionStore().specialEducationCodesMap.get(this.sdcStudentTwoDetailCopy.specialEducationCategoryCode)?.specialEducationCategoryCode} - ${sdcCollectionStore().specialEducationCodesMap.get(this.sdcStudentTwoDetailCopy.specialEducationCategoryCode)?.description}` : this.sdcStudentTwoDetailCopy.specialEducationCategoryCode;
let description = specEdProg1Description + ' & ' + specEdProg2Description;
programs.push({code: [this.sdcStudentOneDetailCopy.specialEducationCategoryCode, this.sdcStudentTwoDetailCopy.specialEducationCategoryCode], description: description, studentOne: this.sdcStudentOneDetailCopy, studentTwo: this.sdcStudentTwoDetailCopy});
programs.push({code: this.sdcStudentOneDetailCopy.specialEducationCategoryCode, description: '', studentOne: this.sdcStudentOneDetailCopy, studentTwo: this.sdcStudentTwoDetailCopy});
} else if (this.selectedProgramDuplicate?.programDuplicateTypeCode === 'INDIGENOUS') {
let mappedPrograms = this.mapEnrolledProgram(enrolledProgram.INDIGENOUS_ENROLLED_PROGRAM_CODES);
for(let progs of mappedPrograms) {
programs.push(progs);
}
} else if(this.selectedProgramDuplicate?.programDuplicateTypeCode === 'CAREER') {
let stud1CareerProgramCode = this.sdcStudentOneDetailCopy.enrolledProgramCodes.match(/.{1,2}/g).filter(code => enrolledProgram.CAREER_ENROLLED_PROGRAM_CODES.includes(code))[0];
let stud2CareerProgramCode = this.sdcStudentTwoDetailCopy.enrolledProgramCodes.match(/.{1,2}/g).filter(code => enrolledProgram.CAREER_ENROLLED_PROGRAM_CODES.includes(code))[0];
let mappedPrograms = this.mapEnrolledProgram(enrolledProgram.CAREER_ENROLLED_PROGRAM_CODES);
let careerProg1Description = sdcCollectionStore().enrolledProgramCodesMap.get(stud1CareerProgramCode) ? `
${sdcCollectionStore().enrolledProgramCodesMap.get(stud1CareerProgramCode)?.enrolledProgramCode} - ${sdcCollectionStore().enrolledProgramCodesMap.get(stud1CareerProgramCode).description}` : this.sdcStudentOneDetailCopy.careerProgramCode;
let careerProg2Description = sdcCollectionStore().enrolledProgramCodesMap.get(stud2CareerProgramCode) ? `
${sdcCollectionStore().enrolledProgramCodesMap.get(stud2CareerProgramCode)?.enrolledProgramCode} - ${sdcCollectionStore().enrolledProgramCodesMap.get(stud2CareerProgramCode).description}` : this.sdcStudentTwoDetailCopy.careerProgramCode;
// Dupe is in the career program code
if(mappedPrograms.length === 0){
mappedPrograms.push({code: this.sdcStudentOneDetailCopy.careerProgramCode, description: `${this.sdcStudentOneDetailCopy.careerProgramCode} - ${sdcCollectionStore().careerProgramCodesMap.get(this.sdcStudentOneDetailCopy.careerProgramCode).description}`, studentOne: this.sdcStudentOneDetailCopy, studentTwo: this.sdcStudentTwoDetailCopy});
}
let description = careerProg1Description + ' & ' + careerProg2Description;
programs.push({code: [stud1CareerProgramCode, stud2CareerProgramCode], description: description, studentOne: this.sdcStudentOneDetailCopy, studentTwo: this.sdcStudentTwoDetailCopy})
for(let progs of mappedPrograms){
programs.push(progs)
}
} else if(this.selectedProgramDuplicate?.programDuplicateTypeCode === 'LANGUAGE') {
let mappedPrograms = this.mapEnrolledProgram(enrolledProgram.LANGUAGE_PROGRAM_CODES);
Expand All @@ -279,7 +274,7 @@ export default {
this.sdcStudentTwoDetailCopy?.enrolledProgramCodes.includes(programCode))
.map(programCode => {
const enrolledProgram = sdcCollectionStore().enrolledProgramCodesMap.get(programCode);
return {code: [programCode, programCode], description: `${programCode} - ${enrolledProgram.description}`, studentOne: this.sdcStudentOneDetailCopy, studentTwo: this.sdcStudentTwoDetailCopy};
return {code: programCode, description: `${programCode} - ${enrolledProgram.description}`, studentOne: this.sdcStudentOneDetailCopy, studentTwo: this.sdcStudentTwoDetailCopy};
});
},
}
Expand Down

0 comments on commit 66f78a7

Please sign in to comment.