Skip to content

Commit

Permalink
chore(trends): Remove filter and actions from the comparison objects (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilbert09 authored Nov 27, 2023
1 parent 2586d27 commit ed6f3c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/queries/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,17 @@ export async function query<N extends DataNode = DataNode>(
fetchLegacyInsights(),
])

const res1 = response?.result || response?.results
const res2 = legacyResponse?.result || legacyResponse?.results
let res1 = response?.result || response?.results
let res2 = legacyResponse?.result || legacyResponse?.results

if (isLifecycleQuery(queryNode)) {
// Results don't come back in a predetermined order for the legacy lifecycle insight
const order = { new: 1, returning: 2, resurrecting: 3, dormant: 4 }
res1.sort((a: any, b: any) => order[a.status] - order[b.status])
res2.sort((a: any, b: any) => order[a.status] - order[b.status])
} else if (isTrendsQuery(queryNode)) {
res1 = res1?.map((n: any) => ({ ...n, filter: undefined, action: undefined }))
res2 = res2?.map((n: any) => ({ ...n, filter: undefined, action: undefined }))
}

const results = flattenObject(res1)
Expand Down

0 comments on commit ed6f3c3

Please sign in to comment.