Skip to content

Commit

Permalink
fix: fix issue with sorting by submission date
Browse files Browse the repository at this point in the history
fix: fix issue with sorting by submission date
  • Loading branch information
timisenco2015 authored Aug 22, 2023
2 parents 7224697 + 6ccd150 commit 6b11897
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/frontend/src/components/forms/SubmissionsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export default {
itemsPerPage: 10,
page: 0,
filterData: [],
sortBy: '',
sortBy: undefined,
sortDesc: false,
filterIgnore: [
{
Expand Down Expand Up @@ -623,8 +623,8 @@ export default {
},
async updateTableOptions({ page, itemsPerPage, sortBy, sortDesc }) {
this.page = page - 1;
this.sortBy = sortBy;
this.sortDesc = sortDesc;
this.sortBy = sortBy[0] === 'date' ? 'createdAt' : sortBy[0];
this.sortDesc = sortDesc[0];
this.itemsPerPage = itemsPerPage;
await this.getSubmissionData();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default {
page: 0,
filterData: [],
preSelectedData: [],
sortBy: '',
sortBy: undefined,
sortDesc: false,
filterIgnore: [
{
Expand Down Expand Up @@ -323,10 +323,9 @@ export default {
},
async updateTableOptions({ page, itemsPerPage, sortBy, sortDesc }) {
this.page = page - 1;
this.sortBy = sortBy;
this.sortDesc = sortDesc;
this.sortBy = sortBy[0] === 'date' ? 'createdAt' : sortBy[0];
this.sortDesc = sortDesc[0];
this.itemsPerPage = itemsPerPage;
await this.populateSubmissionsTable();
},
async populateSubmissionsTable() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/forms/common/models/views/submissionMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class SubmissionMetadata extends Model {
if (!pagination) {
builder.orderBy('createdAt', 'DESC');
} else {
let orderBy = params?.sortBy[0];
let orderDesc = params?.sortDesc[0];
let orderBy = params?.sortBy;
let orderDesc = params?.sortDesc;
if (orderDesc === 'true') {
builder.orderBy(orderBy, 'desc');
} else if (orderDesc === 'false') {
Expand Down
4 changes: 2 additions & 2 deletions app/src/forms/common/models/views/userSubmissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class UserSubmissions extends Model {
if (!pagination) {
builder.orderBy('createdAt', 'DESC');
} else {
let orderBy = params?.sortBy[0];
let orderDesc = params?.sortDesc[0];
let orderBy = params?.sortBy;
let orderDesc = params?.sortDesc;
if (orderDesc === 'true') {
builder.orderBy(orderBy, 'desc');
} else if (orderDesc === 'false') {
Expand Down

0 comments on commit 6b11897

Please sign in to comment.