Skip to content

Commit

Permalink
Merge branch 'main' into enh/individual-score-reports
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasxsong committed Mar 7, 2024
2 parents fc49261 + 38d9212 commit b09dbf9
Show file tree
Hide file tree
Showing 6 changed files with 387 additions and 75 deletions.
10 changes: 2 additions & 8 deletions cypress/e2e/participant/network-tests/roar-swr/playSWR-2G.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ describe('Testing playthrough of SWR as a participant under a 2G Mobile connecti
cy.wait(0.5 * timeout);
cy.visit('/');

cy.get('.p-dropdown-trigger', { timeout: 3 * timeout })
.should('be.visible')
.click();
cy.get('.p-dropdown-item', { timeout: 3 * timeout })
.contains(Cypress.env('testRoarAppsAdministration'))
.should('be.visible')
.click();
cy.selectAdministration(Cypress.env('testRoarAppsAdministration'));

cy.get('.p-tabview').contains('ROAR - Word');
cy.get('.p-tabview', { timeout: 3 * timeout }).contains('ROAR - Word');
cy.visit(`/game/swr`);

cy.get('.jspsych-btn', { timeout: 3 * timeout })
Expand Down
10 changes: 2 additions & 8 deletions cypress/e2e/participant/network-tests/roar-swr/playSWR-3G.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ describe('Testing playthrough of SWR as a participant under a 3G Mobile connecti
cy.wait(0.3 * timeout);
cy.visit('/');

cy.get('.p-dropdown-trigger', { timeout: 2 * timeout })
.should('be.visible')
.click();
cy.get('.p-dropdown-item', { timeout: 2 * timeout })
.contains(Cypress.env('testRoarAppsAdministration'))
.should('be.visible')
.click();
cy.selectAdministration(Cypress.env('testRoarAppsAdministration'));

cy.get('.p-tabview').contains('ROAR - Word');
cy.get('.p-tabview', { timeout: 2 * timeout }).contains('ROAR - Word');
cy.visit(`/game/swr`);

cy.get('.jspsych-btn', { timeout: 2 * timeout })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ describe('Testing playthrough of SWR as a participant under a 2G Mobile connecti
cy.wait(0.5 * timeout);
cy.visit('/');

cy.get('.p-dropdown-trigger', { timeout: 6 * timeout })
.should('be.visible')
.click();
cy.get('.p-dropdown-item', { timeout: 6 * timeout })
.contains(Cypress.env('testRoarAppsAdministration'))
.should('be.visible')
.click();
cy.selectAdministration(Cypress.env('testRoarAppsAdministration'));

cy.get('.p-tabview', { timeout: 6 * timeout }).contains('ROAR - Word');
cy.visit(`/game/swr`);
Expand Down
20 changes: 18 additions & 2 deletions src/components/RoarDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
:field="col.field"
:data-type="col.dataType"
:sortable="col.sort !== false"
:show-filter-match-modes="!col.useMultiSelect && col.dataType !== 'score'"
:show-filter-match-modes="!col.useMultiSelect && col.dataType !== 'score' && col.dataType !== 'progress'"
:show-filter-operator="col.allowMultipleFilters === true"
:filter-field="col.dataType === 'score' ? `scores.${col.field?.split('.')[1]}.percentile` : col.field"
:show-add-button="col.allowMultipleFilters === true"
Expand Down Expand Up @@ -232,6 +232,13 @@
style="margin-bottom: 0.5rem"
/>
</div>
<div v-if="col.dataType === 'progress'">
<PvDropdown
v-model="filterModel.value"
:options="['Assigned', 'Started', 'Completed']"
style="margin-bottom: 0.5rem"
/>
</div>
</template>
</PvColumn>
<template #empty> No data found. </template>
Expand Down Expand Up @@ -372,7 +379,7 @@ function increasePadding() {
}
// Generate filters and options objects
const valid_dataTypes = ['NUMERIC', 'NUMBER', 'TEXT', 'STRING', 'DATE', 'BOOLEAN', 'SCORE'];
const valid_dataTypes = ['NUMERIC', 'NUMBER', 'TEXT', 'STRING', 'DATE', 'BOOLEAN', 'SCORE', 'PROGRESS'];
let filters = {};
let options = {};
_forEach(computedColumns.value, (column) => {
Expand All @@ -395,6 +402,8 @@ _forEach(computedColumns.value, (column) => {
if (scoredTasks.includes(column.field.split('.')[1])) {
returnMatchMode = { value: null, matchMode: FilterMatchMode.STARTS_WITH };
}
} else if (dataType === 'PROGRESS') {
returnMatchMode = { value: null, matchMode: FilterMatchMode.STARTS_WITH };
}
if (_get(column, 'useMultiSelect')) {
Expand Down Expand Up @@ -595,10 +604,12 @@ const onFilter = (event) => {
margin-top: 5px;
margin-bottom: 5px;
}
button.p-button.p-component.softer {
background: #f3adad;
color: black;
}
button.p-column-filter-menu-button.p-link,
g {
color: white;
Expand All @@ -619,6 +630,7 @@ g {
font-size: smaller;
color: var(--surface-500);
}
.view-label2 {
position: absolute;
top: -15px;
Expand All @@ -640,18 +652,22 @@ button.p-column-filter-menu-button.p-link:hover {
border-width: 0 0 3px 0;
padding: 1px 1.5rem 2px 1.5rem;
}
.filter-content {
width: 12rem;
}
.filter-button-override .p-column-filter-menu-button:not(.p-column-filter-menu-button-active) {
display: none;
}
.p-column-filter-matchmode-dropdown {
/* Our current filtering queries do not support options other than equals
for strings. To reduce confusion for end users, remove the dropdown
offering different matchmodes */
display: none;
}
.scrollable-container::-webkit-scrollbar {
width: 10px;
}
Expand Down
40 changes: 32 additions & 8 deletions src/helpers/query/assignments.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,31 @@ export const getAssignmentsRequestBody = ({
});
}

if (!_isEmpty(orderBy)) {
requestBody.structuredQuery.orderBy = orderBy;
}

if (!_isEmpty(filter)) {
if (filter?.value === 'Completed') {
requestBody.structuredQuery.where.compositeFilter.filters.push({
fieldFilter: {
field: { fieldPath: `progress.${filter.taskId}` },
op: 'EQUAL',
value: { stringValue: 'completed' },
},
});
} else if (filter?.value === 'Started') {
requestBody.structuredQuery.where.compositeFilter.filters.push({
fieldFilter: {
field: { fieldPath: `progress.${filter.taskId}` },
op: 'EQUAL',
value: { stringValue: 'started' },
},
});
} else if (filter?.value === 'Assigned') {
requestBody.structuredQuery.where.compositeFilter.filters.push({
fieldFilter: {
field: { fieldPath: `progress.${filter.taskId}` },
op: 'EQUAL',
value: { stringValue: 'assigned' },
},
});
} else if (!_isEmpty(filter)) {
requestBody.structuredQuery.where.compositeFilter.filters.push({
fieldFilter: {
field: { fieldPath: `userData.${filter.field}` },
Expand All @@ -148,6 +168,10 @@ export const getAssignmentsRequestBody = ({
};
}

if (!_isEmpty(orderBy)) {
requestBody.structuredQuery.orderBy = orderBy;
}

if (aggregationQuery) {
return {
structuredAggregationQuery: {
Expand Down Expand Up @@ -649,7 +673,7 @@ export const assignmentCounter = (adminId, orgType, orgId, filters = []) => {
let userFilter = null;
let orgFilter = null;
let gradeFilter = null;
if (nonOrgFilter && nonOrgFilter.collection === 'users') {
if (nonOrgFilter && nonOrgFilter.collection === 'users' && nonOrgFilter.collection === 'assignments') {
userFilter = nonOrgFilter;
}
if (orgFilters && orgFilters.collection === 'schools' && !_isEmpty(orgFilters.value)) {
Expand All @@ -664,7 +688,7 @@ export const assignmentCounter = (adminId, orgType, orgId, filters = []) => {
orgId: orgFilter ? null : orgId,
orgArray: orgFilter,
aggregationQuery: true,
filter: userFilter,
filter: userFilter || nonOrgFilter,
grades: gradeFilter,
});
return adminAxiosInstance.post(':runAggregationQuery', requestBody).then(({ data }) => {
Expand Down Expand Up @@ -921,7 +945,7 @@ export const assignmentPageFetcher = async (
page: page.value,
paginate: paginate,
select: select,
filter: userFilter,
filter: userFilter || nonOrgFilter,
grades: gradeFilter,
orderBy: toRaw(orderBy),
});
Expand Down
Loading

0 comments on commit b09dbf9

Please sign in to comment.