From 3f0535bf0b43364407fab471c95130676399ec1b Mon Sep 17 00:00:00 2001 From: mightycox Date: Mon, 13 May 2024 16:19:50 -0700 Subject: [PATCH] EDX-2406 - Show program duplicate type --- backend/src/components/cache-service.js | 8 ++++++++ backend/src/components/sdc.js | 6 ++++++ backend/src/config/index.js | 1 + backend/src/server.js | 5 +++++ backend/src/util/constants.js | 3 ++- .../stepFourInDistrictDuplicates/DuplicateTab.vue | 9 ++++++++- .../StepFourInDistrictDuplicates.vue | 2 +- 7 files changed, 31 insertions(+), 3 deletions(-) diff --git a/backend/src/components/cache-service.js b/backend/src/components/cache-service.js index 0531afe37..66a4e9aee 100644 --- a/backend/src/components/cache-service.js +++ b/backend/src/components/cache-service.js @@ -24,6 +24,7 @@ let bandCodesMap = new Map(); let enrolledProgramCodesMap = new Map(); let careerProgramCodesMap = new Map(); let duplicateResolutionCodesMap = new Map(); +let programDuplicateTypeCodesMap = new Map(); let schoolFundingCodesMap = new Map(); let specialEducationCodesMap = new Map(); let rolePermissionsMap = new Map(); @@ -265,6 +266,13 @@ const cacheService = { }); return duplicateResolutionCodesMap; }, + getAllProgramDuplicateTypeCodesMap() { + let programDuplicateTypeCodes = cachedData[constants.CACHE_KEYS.SDC_PROGRAM_DUPLICATE_TYPE_CODES].records; + programDuplicateTypeCodes.forEach(programDuplicateTypeCode => { + programDuplicateTypeCodesMap.set(programDuplicateTypeCode.programDuplicateTypeCode, programDuplicateTypeCode); + }); + return programDuplicateTypeCodesMap; + }, getEnrolledProgramCodesMap() { let enrolledProgramCodesRaw = cachedData[constants.CACHE_KEYS.SDC_ENROLLED_PROGRAM_CODES].activeRecords; let enrolledProgramCodes = enrolledProgramCodesRaw.map(item => { diff --git a/backend/src/components/sdc.js b/backend/src/components/sdc.js index a3de375fa..2bd90f1bf 100644 --- a/backend/src/components/sdc.js +++ b/backend/src/components/sdc.js @@ -677,6 +677,7 @@ async function getInDistrictDuplicates(req, res) { result.programDuplicates.RESOLVED.push(sdcDuplicate); } else if (sdcDuplicate?.duplicateTypeCode === DUPLICATE_TYPE_CODES.PROGRAM) { + setProgramDuplicateTypeMessage(sdcDuplicate); result.programDuplicates.NON_ALLOW.push(sdcDuplicate); } }); @@ -711,6 +712,11 @@ function setIfOnlineStudentAndCanChangeGrade(sdcDuplicate, school1, school2) { } } +function setProgramDuplicateTypeMessage(sdcDuplicate) { + const programDuplicateTypeCodes = cacheService.getAllProgramDuplicateTypeCodesMap(); + sdcDuplicate.programDuplicateTypeCodeDescription = programDuplicateTypeCodes.get(sdcDuplicate.programDuplicateTypeCode)?.label; +} + module.exports = { getCollectionBySchoolId, uploadFile, diff --git a/backend/src/config/index.js b/backend/src/config/index.js index 187f06331..b4ac6b605 100644 --- a/backend/src/config/index.js +++ b/backend/src/config/index.js @@ -123,6 +123,7 @@ nconf.defaults({ programEligibilityTypeCodesURL: process.env.SDC_API_ENDPOINT + '/program-eligibility-issue-codes', zeroFteReasonCodesURL: process.env.SDC_API_ENDPOINT + '/zero-fte-reason-codes', duplicateResolutionCodesURL: process.env.SDC_API_ENDPOINT + '/duplicate-resolution-codes', + programDuplicateTypeCodesURL: process.env.SDC_API_ENDPINT + '/program-duplicate-type-codes' }, frontendConfig: { bannerEnvironment: process.env.BANNER_ENVIRONMENT, diff --git a/backend/src/server.js b/backend/src/server.js index 3310509ff..362709e33 100644 --- a/backend/src/server.js +++ b/backend/src/server.js @@ -146,6 +146,11 @@ if(process.env.NODE_ENV !== 'test'){ //do not cache for test environment to sto }).catch((e) => { log.error('Error loading SDC_DUPLICATE_RESOLUTION_CODES data during boot.', e); }); + cacheService.loadDataToCache(constants.CACHE_KEYS.SDC_PROGRAM_DUPLICATE_TYPE_CODES, 'sdc:programDuplicateTypeCodesURL').then(() => { + log.info('Loaded SDC_PROGRAM_DUPLICATE_TYPE_CODES data to memory'); + }).catch((e) => { + log.error('Error loading SDC_PROGRAM_DUPLICATE_TYPE_CODES data during boot.', e); + }); } } diff --git a/backend/src/util/constants.js b/backend/src/util/constants.js index ff59e45bd..31e997e69 100644 --- a/backend/src/util/constants.js +++ b/backend/src/util/constants.js @@ -165,7 +165,8 @@ cacheKeys = { SDC_VALIDATION_ISSUE_TYPE_CODES: 'sdc_validation_issue_type_codes', SDC_PROGRAM_ELIGIBILITY_TYPE_CODES: 'sdc_program_eligibility_type_codes', SDC_ZERO_FTE_REASON_CODES: 'sdc_zero_fte_reason_codes', - SDC_DUPLICATE_RESOLUTION_CODES: 'sdc_duplicate_resolution_codes' + SDC_DUPLICATE_RESOLUTION_CODES: 'sdc_duplicate_resolution_codes', + SDC_PROGRAM_DUPLICATE_TYPE_CODES: 'sdc_program_duplicate_type_codes' }; const CACHE_KEYS = Object.freeze(cacheKeys); const EVENT_WS_TOPIC = 'EVENT_WS_TOPIC'; diff --git a/frontend/src/components/sdcCollection/sdcDistrictCollection/stepFourInDistrictDuplicates/DuplicateTab.vue b/frontend/src/components/sdcCollection/sdcDistrictCollection/stepFourInDistrictDuplicates/DuplicateTab.vue index 36c43f5e9..681c693ed 100644 --- a/frontend/src/components/sdcCollection/sdcDistrictCollection/stepFourInDistrictDuplicates/DuplicateTab.vue +++ b/frontend/src/components/sdcCollection/sdcDistrictCollection/stepFourInDistrictDuplicates/DuplicateTab.vue @@ -46,7 +46,14 @@ Assigned PEN: {{ duplicate.sdcSchoolCollectionStudent1Entity.assignedPen }} - Error: {{ duplicate.duplicateErrorDescriptionCode }} + + Error: {{ duplicate.duplicateErrorDescriptionCode }} + + + Duplicate Program: {{ duplicate.programDuplicateTypeCodeDescription }} + diff --git a/frontend/src/components/sdcCollection/sdcDistrictCollection/stepFourInDistrictDuplicates/StepFourInDistrictDuplicates.vue b/frontend/src/components/sdcCollection/sdcDistrictCollection/stepFourInDistrictDuplicates/StepFourInDistrictDuplicates.vue index f64348a88..26b3efa69 100644 --- a/frontend/src/components/sdcCollection/sdcDistrictCollection/stepFourInDistrictDuplicates/StepFourInDistrictDuplicates.vue +++ b/frontend/src/components/sdcCollection/sdcDistrictCollection/stepFourInDistrictDuplicates/StepFourInDistrictDuplicates.vue @@ -44,7 +44,7 @@ >