Skip to content

Commit

Permalink
remove prototype filtering code from assessments
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasxsong committed Feb 28, 2024
1 parent 6b6d8f9 commit 494f1ad
Showing 1 changed file with 8 additions and 42 deletions.
50 changes: 8 additions & 42 deletions src/helpers/query/assignments.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,47 +129,13 @@ export const getAssignmentsRequestBody = ({
}

if (!_isEmpty(filter)) {
if (filter.value === 'Completed' || filter.value === 'Assigned' || filter.value === 'Started') {
console.log('completed called');
if (filter.value === 'Completed') {
// console.log('completed called');
// requestBody.structuredQuery.where.compositeFilter.filters.push({
// unaryFilter: {
// op: 'IS_NOT_NULL',
// field: { fieldPath: `completed` },
// },
// });
requestBody.structuredQuery.where.compositeFilter.filters.push({
fieldFilter: {
field: { fieldPath: `assessments` },
op: 'EQUAL',
value: { stringValue: '2' },
},
});
} else if (filter.value === 'Assigned') {
requestBody.structuredQuery.where.compositeFilter.filters.push({
unaryFilter: {
op: 'IS_NULL',
field: { fieldPath: `startedOn` },
},
});
} else if (filter.value === 'Started') {
requestBody.structuredQuery.where.compositeFilter.filters.push({
unaryFilter: {
op: 'IS_NOT_NULL',
field: { fieldPath: `startedOn` },
},
});
}
} else {
requestBody.structuredQuery.where.compositeFilter.filters.push({
fieldFilter: {
field: { fieldPath: `userData.${filter.field}` },
op: 'EQUAL',
value: { stringValue: filter.value },
},
});
}
requestBody.structuredQuery.where.compositeFilter.filters.push({
fieldFilter: {
field: { fieldPath: `userData.${filter.field}` },
op: 'EQUAL',
value: { stringValue: filter.value },
},
});
}
} else {
const currentDate = new Date().toISOString();
Expand Down Expand Up @@ -685,7 +651,7 @@ export const assignmentCounter = (adminId, orgType, orgId, filters = []) => {
}
});
let requestBody;
if (nonOrgFilter && nonOrgFilter.collection === 'scores' && nonOrgFilter.constraint.value !== 'Assigned') {
if (nonOrgFilter && nonOrgFilter.collection === 'scores') {
let orgFilter = null;
let gradeFilter = null;
if (orgFilters && orgFilters.collection === 'schools' && !_isEmpty(orgFilters.value)) {
Expand Down

0 comments on commit 494f1ad

Please sign in to comment.