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-2400 - Fixes bug in display school name #1511

Merged
merged 2 commits into from
May 7, 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
15 changes: 8 additions & 7 deletions backend/src/components/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,16 +658,17 @@ async function getInDistrictDuplicates(req, res) {
}
};
sdcDuplicates.forEach(sdcDuplicate => {
const school = cacheService.getSchoolBySchoolID(sdcDuplicate.sdcSchoolCollectionStudent1Entity?.schoolID);
sdcDuplicate.sdcSchoolCollectionStudent1Entity.schoolName = getSchoolName(school);
sdcDuplicate.sdcSchoolCollectionStudent2Entity.schoolName = getSchoolName(school);
const school1 = cacheService.getSchoolBySchoolID(sdcDuplicate.sdcSchoolCollectionStudent1Entity?.schoolID);
sdcDuplicate.sdcSchoolCollectionStudent1Entity.schoolName = getSchoolName(school1);
const school2 = cacheService.getSchoolBySchoolID(sdcDuplicate.sdcSchoolCollectionStudent2Entity?.schoolID);
sdcDuplicate.sdcSchoolCollectionStudent2Entity.schoolName = getSchoolName(school2);

if (sdcDuplicate?.duplicateTypeCode === DUPLICATE_TYPE_CODES.ENROLLMENT && sdcDuplicate.duplicateResolutionCode) {
setStudentResolvedMessage(sdcDuplicate);
result.enrollmentDuplicates.RESOLVED.push(sdcDuplicate);
}
else if (sdcDuplicate?.duplicateTypeCode === DUPLICATE_TYPE_CODES.ENROLLMENT) {
setIfOnlineStudentAndCanChangeGrade(sdcDuplicate, school);
setIfOnlineStudentAndCanChangeGrade(sdcDuplicate, school1, school2);
result.enrollmentDuplicates[sdcDuplicate.duplicateSeverityCode].push(sdcDuplicate);
}
else if (sdcDuplicate?.duplicateTypeCode === DUPLICATE_TYPE_CODES.PROGRAM) {
Expand Down Expand Up @@ -696,11 +697,11 @@ function setStudentResolvedMessage(sdcDuplicate) {
}
}

function setIfOnlineStudentAndCanChangeGrade(sdcDuplicate, school) {
if(['DIST_LEARN', 'DISTONLINE'].includes(school.facilityTypeCode) && ['08', '09'].includes(sdcDuplicate.sdcSchoolCollectionStudent1Entity.enrolledGradeCode)) {
function setIfOnlineStudentAndCanChangeGrade(sdcDuplicate, school1, school2) {
if(['DIST_LEARN', 'DISTONLINE'].includes(school1.facilityTypeCode) && ['08', '09'].includes(sdcDuplicate.sdcSchoolCollectionStudent1Entity.enrolledGradeCode)) {
sdcDuplicate.sdcSchoolCollectionStudent1Entity.canChangeGrade = true;
}
if(['DIST_LEARN', 'DISTONLINE'].includes(school.facilityTypeCode) && ['08', '09'].includes(sdcDuplicate.sdcSchoolCollectionStudent2Entity.enrolledGradeCode)) {
if(['DIST_LEARN', 'DISTONLINE'].includes(school2.facilityTypeCode) && ['08', '09'].includes(sdcDuplicate.sdcSchoolCollectionStudent2Entity.enrolledGradeCode)) {
sdcDuplicate.sdcSchoolCollectionStudent2Entity.canChangeGrade = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,162 +36,171 @@
{{ name }}
</v-tab>
</v-tabs>
<v-row class="mt-3 mb-3 pl-3">
<v-btn-toggle
v-model="duplicateView"
color="#003366"
rounded="0"
:divided="true"
<v-window v-model="tab">
<v-window-item
value="Enrollment Duplicates"
transition="false"
reverse-transition="false"
>
<v-btn
id="nonAllowableButton"
value="nonAllowable"
size="large"
class="duplicate-type-button"
<v-row
v-if="tab==='Enrollment Duplicates'"
class="mt-3 mb-3 pl-3"
>
Non-Allowable ({{ nonAllowableDuplicates.length }})
</v-btn>
<v-btn
id="allowableButton"
value="allowable"
size="large"
class="duplicate-type-button"
>
Allowable ({{ allowableDuplicates.length }})
</v-btn>
<v-btn
id="resolvedButton"
value="resolved"
size="large"
class="duplicate-type-button"
>
Resolved ({{ resolvedDuplicates.length }})
</v-btn>
</v-btn-toggle>
</v-row>
<template v-if="duplicateView==='nonAllowable'">
<strong>Duplicate Students Found: {{ nonAllowableDuplicates.length }}</strong>
<v-row
v-for="duplicate in nonAllowableDuplicates"
:key="duplicate.sdcDuplicateID"
class="pt-4"
no-gutters
>
<v-col class="pa-0">
<v-row no-gutters>
<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-chip>
</v-col>
</v-row>
<CustomTable
:headers="IN_DISTRICT_DUPLICATES.nonAllowableTableHeaders"
:data="[duplicate?.sdcSchoolCollectionStudent1Entity, duplicate?.sdcSchoolCollectionStudent2Entity]"
:is-loading="false"
:reset="false"
:total-elements="2"
:hide-pagination="true"
<v-btn-toggle
v-model="duplicateView"
color="#003366"
rounded="0"
:divided="true"
>
<v-btn
id="nonAllowableButton"
value="nonAllowable"
size="large"
class="duplicate-type-button"
>
Non-Allowable ({{ nonAllowableDuplicates.length }})
</v-btn>
<v-btn
id="allowableButton"
value="allowable"
size="large"
class="duplicate-type-button"
>
Allowable ({{ allowableDuplicates.length }})
</v-btn>
<v-btn
id="resolvedButton"
value="resolved"
size="large"
class="duplicate-type-button"
>
Resolved ({{ resolvedDuplicates.length }})
</v-btn>
</v-btn-toggle>
</v-row>
<template v-if="duplicateView==='nonAllowable'">
<strong>Duplicate Students Found: {{ nonAllowableDuplicates.length }}</strong>
<v-row
v-for="duplicate in nonAllowableDuplicates"
:key="duplicate.sdcDuplicateID"
class="pt-4"
no-gutters
>
<template #resolution="{ sdcSchoolCollectionStudent }">
<v-menu
v-model="editOptionsOpen[sdcSchoolCollectionStudent.sdcSchoolCollectionStudentID + duplicate.sdcDuplicateID]"
transition="fab-transition"
location="end"
offset="10"
<v-col class="pa-0">
<v-row no-gutters>
<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-chip>
</v-col>
</v-row>
<CustomTable
:headers="IN_DISTRICT_DUPLICATES.nonAllowableTableHeaders"
:data="[duplicate?.sdcSchoolCollectionStudent1Entity, duplicate?.sdcSchoolCollectionStudent2Entity]"
:is-loading="false"
:reset="false"
:total-elements="2"
:hide-pagination="true"
>
<template #activator="{ props }">
<v-btn
:id="'resolveMenuBtn' + sdcSchoolCollectionStudent.sdcSchoolCollectionStudentID"
color="primary"
icon="mdi-playlist-edit"
variant="text"
v-bind="props"
/>
<template #resolution="{ sdcSchoolCollectionStudent }">
<v-menu
v-model="editOptionsOpen[sdcSchoolCollectionStudent.sdcSchoolCollectionStudentID + duplicate.sdcDuplicateID]"
transition="fab-transition"
location="end"
offset="10"
>
<template #activator="{ props }">
<v-btn
:id="'resolveMenuBtn' + sdcSchoolCollectionStudent.sdcSchoolCollectionStudentID"
color="primary"
icon="mdi-playlist-edit"
variant="text"
v-bind="props"
/>
</template>
<v-list>
<v-list-item v-if="sdcSchoolCollectionStudent.canChangeGrade">
<v-icon
color="#003366"
class="pr-1 mb-1"
>
mdi-pencil
</v-icon>
<span class="ml-2">Change Grade</span>
</v-list-item>
<v-list-item>
<v-icon
color="#003366"
class="pr-1 mb-1"
>
mdi-check
</v-icon>
<span class="ml-2">Resolve</span>
</v-list-item>
</v-list>
</v-menu>
</template>
<v-list>
<v-list-item v-if="sdcSchoolCollectionStudent.canChangeGrade">
<v-icon
color="#003366"
class="pr-1 mb-1"
>
mdi-pencil
</v-icon>
<span class="ml-2">Change Grade</span>
</v-list-item>
<v-list-item>
<v-icon
color="#003366"
class="pr-1 mb-1"
>
mdi-check
</v-icon>
<span class="ml-2">Resolve</span>
</v-list-item>
</v-list>
</v-menu>
</template>
</CustomTable>
</v-col>
</v-row>
<v-row
v-if="nonAllowableDuplicates.length === 0"
class="pt-4"
no-gutters
>
<v-alert
id="enrollment-non-allowable-alert"
density="compact"
type="success"
variant="tonal"
text="Congratulations! There are no non-allowable duplicates."
/>
</v-row>
</template>
<template v-if="duplicateView==='allowable'">
<strong>Duplicate Students Found: {{ allowableDuplicates.length }}</strong>
<v-row
v-for="duplicate in allowableDuplicates"
:key="duplicate.sdcDuplicateID"
class="pt-4"
no-gutters
>
<v-col class="pa-0">
<v-row no-gutters>
<v-col class="pb-2">
<v-chip color="primary">
<v-col>
Assigned PEN: {{ duplicate.sdcSchoolCollectionStudent1Entity.assignedPen }}
</CustomTable>
</v-col>
</v-row>
<v-row
v-if="nonAllowableDuplicates.length === 0"
class="pt-4"
no-gutters
>
<v-alert
id="enrollment-non-allowable-alert"
density="compact"
type="success"
variant="tonal"
text="Congratulations! There are no non-allowable duplicates."
/>
</v-row>
</template>
<template v-if="duplicateView==='allowable'">
<strong>Duplicate Students Found: {{ allowableDuplicates.length }}</strong>
<v-row
v-for="duplicate in allowableDuplicates"
:key="duplicate.sdcDuplicateID"
class="pt-4"
no-gutters
>
<v-col class="pa-0">
<v-row no-gutters>
<v-col class="pb-2">
<v-chip color="primary">
<v-col>
Assigned PEN: {{ duplicate.sdcSchoolCollectionStudent1Entity.assignedPen }}
</v-col>
</v-chip>
</v-col>
</v-chip>
</v-row>
<CustomTable
:headers="IN_DISTRICT_DUPLICATES.allowableTableHeaders"
:data="[duplicate?.sdcSchoolCollectionStudent1Entity, duplicate?.sdcSchoolCollectionStudent2Entity]"
:is-loading="false"
:reset="false"
:total-elements="2"
:hide-pagination="true"
/>
</v-col>
</v-row>
<CustomTable
:headers="IN_DISTRICT_DUPLICATES.allowableTableHeaders"
:data="[duplicate?.sdcSchoolCollectionStudent1Entity, duplicate?.sdcSchoolCollectionStudent2Entity]"
:is-loading="false"
:reset="false"
:total-elements="2"
:hide-pagination="true"
/>
</v-col>
</v-row>
<v-row
v-if="allowableDuplicates.length === 0"
class="pt-4"
no-gutters
>
<v-alert
id="enrollment-allowable-alert"
density="compact"
type="info"
variant="tonal"
text="There are no allowable duplicates."
/>
</v-row>
</template>
<template v-if="duplicateView==='resolved'">
<v-row
v-if="allowableDuplicates.length === 0"
class="pt-4"
no-gutters
>
<v-alert
id="enrollment-allowable-alert"
density="compact"
type="info"
variant="tonal"
text="There are no allowable duplicates."
/>
</v-row>
</template>
<template v-if="duplicateView==='resolved'">
<strong>Duplicate Students Found: {{ resolvedDuplicates.length }}</strong>
<v-row
v-for="duplicate in resolvedDuplicates"
Expand Down Expand Up @@ -233,6 +242,8 @@
/>
</v-row>
</template>
</v-window-item>
</v-window>
</div>

<v-row justify="end">
Expand Down
Loading