Skip to content

Commit

Permalink
fix: fixed order by count not being honoured in table view - trace
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarRajput-7 committed Jan 15, 2025
1 parent adcb117 commit daf98c3
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions frontend/src/lib/query/createTableColumnsFromQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,30 +572,6 @@ export const createTableColumnsFromQuery: CreateTableDataFromQuery = ({
a.queryName < b.queryName ? -1 : 1,
);

console.log('here', queryTableData, query);
// the reason we need this is because the filling of values in rows doesn't account for mismatch enteries
// in the response. Example : Series A -> [label1, label2] and Series B -> [label2,label1] this isn't accounted for
sortedQueryTableData.forEach((q) => {
q.series?.forEach((s) => {
s.labelsArray?.sort((a, b) =>
Object.keys(a)[0] < Object.keys(b)[0] ? -1 : 1,
);
});
q.series?.sort((a, b) => {
let labelA = '';
let labelB = '';
a.labelsArray?.forEach((lab) => {
labelA += Object.values(lab)[0];
});

b.labelsArray?.forEach((lab) => {
labelB += Object.values(lab)[0];
});

return labelA < labelB ? -1 : 1;
});
});

const dynamicColumns = getDynamicColumns(sortedQueryTableData, query);

const { filledDynamicColumns, rowsLength } = fillColumnsData(
Expand Down

0 comments on commit daf98c3

Please sign in to comment.