Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDX-2406 - Show program duplicate type #1530

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions backend/src/components/cache-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 => {
Expand Down
6 changes: 6 additions & 0 deletions backend/src/components/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions backend/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions backend/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
}

Expand Down
3 changes: 2 additions & 1 deletion backend/src/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@
<v-col class="pb-2">
<v-chip color="primary">
<v-col>Assigned PEN: {{ duplicate.sdcSchoolCollectionStudent1Entity.assignedPen }}</v-col>
<v-col>Error: {{ duplicate.duplicateErrorDescriptionCode }}</v-col>
<v-col
v-if="duplicateType==='enrollment'"
>
Error: {{ duplicate.duplicateErrorDescriptionCode }}
</v-col>
<v-col v-else>
Duplicate Program: {{ duplicate.programDuplicateTypeCodeDescription }}
</v-col>
</v-chip>
</v-col>
</v-row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
>
<DuplicateTab
v-if="tab==='Enrollment Duplicates'"
duplicate-type="program"
duplicate-type="enrollment"
:non-allowable-duplicates="nonAllowableDuplicates"
:allowable-duplicates="allowableDuplicates"
:resolved-duplicates="resolvedDuplicates"
Expand Down
Loading