Skip to content

Commit

Permalink
EDX-2853 - switches sldmove to use sdc api
Browse files Browse the repository at this point in the history
EDX-2869 - shows merged data on sld history and compare screens
  • Loading branch information
mightycox committed Sep 11, 2024
1 parent 1567b56 commit a8e1128
Show file tree
Hide file tree
Showing 15 changed files with 1,394 additions and 1,222 deletions.
40 changes: 39 additions & 1 deletion backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"strip-ansi": "^6.0.0",
"uuid": "^8.3.2",
"winston": "^3.5.0",
"winston-daily-rotate-file": "^4.5.0"
"winston-daily-rotate-file": "^4.5.0",
"yup": "^1.4.0"
},
"devDependencies": {
"@babel/cli": "^7.16.8",
Expand Down
15 changes: 13 additions & 2 deletions backend/src/components/sdc/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ async function getSDCSchoolCollectionStudentPaginated(req, res) {
if(req.query.assignedStudentID) {
search.push({
condition: null,
searchCriteriaList: [{ key: 'assignedStudentId', value: req.query.assignedStudentID, operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.UUID }]
searchCriteriaList: [{ key: 'assignedStudentId', value: req.query.assignedStudentID.join(','), operation: FILTER_OPERATION.IN_NOT_DISTINCT, valueType: VALUE_TYPE.UUID }]
});
}

Expand Down Expand Up @@ -888,6 +888,16 @@ async function downloadSdcReport(req, res) {
}
}

async function moveSld (req, res) {
try {
await postData(`${config.get('sdc:schoolCollectionStudentURL')}/move-sld`, req.body);
return res.status(HttpStatus.OK).json('');
} catch (e) {
logApiError(e, 'Error attempting to move sld record(s)');
return errorResponse(res);
}
}

function getFileDetails(reportType) {
const mappings = {
'ALL_STUDENT_DIS_CSV': { filename: 'AllDistrictStudents.csv', contentType: 'text/csv' },
Expand Down Expand Up @@ -929,5 +939,6 @@ module.exports = {
getSdcSchoolCollections,
getSdcDistrictCollections,
downloadSdcReport,
updateBandCode
updateBandCode,
moveSld
};
16 changes: 16 additions & 0 deletions backend/src/components/validator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const validate = (schema) => async (req, res, next) => {
try {
await schema.validate({
body: req.body,
query: req.query,
params: req.params,
}, {
stripUnknown: false
});
next();
} catch (e) {
return res.status(400).send(e.message);
}
};

module.exports = validate;
5 changes: 4 additions & 1 deletion backend/src/routes/sdc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions backend/src/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ const FILTER_OPERATION = Object.freeze(
* Ends with filter operation.
*/
ENDS_WITH: 'ends_with',
/**
* In operation that does not include the DISTINCT condition
*/
IN_NOT_DISTINCT: 'in_not_distinct'
}
);
const CONDITION = Object.freeze(
Expand Down
14 changes: 14 additions & 0 deletions backend/src/validations/sdc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { object, string, array } = require('yup');

const moveSldSchema = object({
body: object({
toStudentPen: string().nonNullable(),
sdcSchoolCollectionIdsToUpdate: array().of(string().nonNullable())
}).noUnknown(),
params: object().noUnknown(),
query: object().noUnknown(),
}).noUnknown();

module.exports = {
moveSldSchema
};
14 changes: 7 additions & 7 deletions frontend/src/components/CompareStudents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@
id="compareClearBtn"
text="Clear"
secondary
@click-action="[cancel, clearError]"
@click-action="[cancel(), clearError()]"
/>
<PrimaryButton
id="moveSldBtn"
text="Move Sld Record"
primary
:disabled="disableMoveSld"
@click-action="moveSldRecords"
:disabled="disableMoveSld()"
@click-action="moveSldRecords()"
/>
<PrimaryButton
id="twinBtn"
text="Twin"
primary
:disabled="validateAction"
@click-action="twin"
:disabled="validateAction()"
@click-action="twin()"
/>
<PrimaryButton
id="demergeBtn"
text="Demerge"
primary
:disabled="disableDemerge()"
@click-action="demerge"
@click-action="demerge()"
/>
<PrimaryButton
id="mergeBtn"
text="Merge PENs"
primary
:disabled="disableMerge()"
@click-action="merge"
@click-action="merge()"
/>
</template>
</CompareDemographicsCommon>
Expand Down
56 changes: 3 additions & 53 deletions frontend/src/components/common/CompareDemographicModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
</template>
<v-card id="requestInfoDialogCard">
<CompareDemographicsCommon
v-if="compareModalOpen && !useEdxRelease"
v-if="compareModalOpen"
v-model:selected-records="studentRecords"
title="Compare/View"
:close-compare-modal="closeCompareModal"
@refresh-sld-data="$emit('refresh-sld-data')"
>
<template #actions="{clearError, validateAction, disableMerge, disableDemerge, disableMoveSld, twin, merge, demerge, moveSldRecords}">
<PrimaryButton
Expand Down Expand Up @@ -59,49 +60,6 @@
/>
</template>
</CompareDemographicsCommon>
<CompareDemographicsCommonV2
v-if="compareModalOpen && useEdxRelease"
v-model:selected-records="studentRecords"
title="Compare/View"
:close-compare-modal="closeCompareModal"
>
<template #actions="{clearError, validateAction, disableMerge, disableDemerge, disableMoveSld, twin, merge, demerge, moveSldRecords}">
<PrimaryButton
id="compareModalCancelBtn"
text="Cancel"
secondary
@click-action="[closeCompareModal(), clearError()]"
/>
<PrimaryButton
id="moveSldBtn"
text="Move Sld Record"
primary
:disabled="disableMoveSld()"
@click-action="moveSldRecords()"
/>
<PrimaryButton
id="twinBtn"
text="Twin"
primary
:disabled="validateAction()"
@click-action="twin()"
/>
<PrimaryButton
id="demergeBtn"
text="Demerge"
primary
:disabled="disableDemerge()"
@click-action="demerge()"
/>
<PrimaryButton
id="mergeBtn"
text="Merge PENs"
primary
:disabled="disableMerge()"
@click-action="merge()"
/>
</template>
</CompareDemographicsCommonV2>
</v-card>
</v-dialog>
</template>
Expand All @@ -113,15 +71,11 @@ import CompareDemographicsCommon from './CompareDemographicsCommon.vue';
import {deepCloneObject} from '@/utils/common';
import alertMixin from '@/mixins/alertMixin';
import staleStudentRecordMixin from '@/mixins/staleStudentRecordMixin';
import CompareDemographicsCommonV2 from '@/components/common/CompareDemographicsCommonV2.vue';
import {mapState} from 'pinia';
import {appStore} from '@/store/modules/app';
export default {
name: 'CompareDemographicModal',
components: {
CompareDemographicsCommon,
CompareDemographicsCommonV2,
PrimaryButton,
TertiaryButton
},
Expand All @@ -140,25 +94,21 @@ export default {
required: true
}
},
emits: ['update:selectedRecords','closeCompare'],
emits: ['update:selectedRecords','closeCompare', 'refresh-sld-data'],
data() {
return {
compareModalOpen: false,
initialSelectedRecord: []
};
},
computed: {
...mapState(appStore, ['config']),
studentRecords: {
get: function() {
return this.selectedRecords;
},
set: function(value) {
this.$emit('update:selectedRecords', value);
}
},
useEdxRelease() {
return !this.config.DISABLE_SDC_FUNCTIONALITY;
}
},
created() {
Expand Down
Loading

0 comments on commit a8e1128

Please sign in to comment.