Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scenario trends label order fix #259

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
const responseTimeDegradationCurve = await db.manyOrNone(
searchResponseTimeDegradation(projectName, scenarioName, envChecked))

const labelTrends = labelData.map(data => data.stats.map(value => ({
percentile90: [data.startDate, value.n0, data.id],
errorRate: [data.startDate, value.errorRate, data.id],
throughput: [data.startDate, value.throughput, data.id],
label: value.label,
})))
labelData.sort(sortByDateAsc)

const labelTrends = labelData.map(data => data.stats.map(value => {
return {
percentile90: [data.startDate, value.n0, data.id],
errorRate: [data.startDate, value.errorRate, data.id],
throughput: [data.startDate, value.throughput, data.id],
label: value.label,
}
}))

const adjusted = {}

Expand All @@ -39,6 +42,7 @@
})
})


const networkAdjustedData = aggregatedData.map((_) => {
const { bytesPerSecond, bytesSentPerSecond } = _.overview
const network = bytesPerSecond + bytesSentPerSecond
Expand Down Expand Up @@ -66,7 +70,7 @@
})

res.status(StatusCode.Ok).json({
aggregatedTrends: networkAdjustedData.sort(sortByDateAsc),
aggregatedTrends: networkAdjustedData.sort(sortAggDataByDateAsc),
responseTimeDegradationCurve: responseTimeDegradationCurveSeries,
labelTrends: adjusted,
userSettings: {
Expand All @@ -80,7 +84,12 @@
})
}

const sortByDateAsc = (a, b): number => {
const sortAggDataByDateAsc = (a, b): number => {
return new Date(a.overview.startDate).getTime() - new Date(b.overview.startDate).getTime()
}

const sortByDateAsc = (a, b): number => {
return new Date(a.startDate).getTime() - new Date(b.startDate).getTime()

Check warning on line 92 in src/server/controllers/scenario/trends/get-scenario-trends-controller.ts

View check run for this annotation

Codecov / codecov/patch

src/server/controllers/scenario/trends/get-scenario-trends-controller.ts#L92

Added line #L92 was not covered by tests

}

Loading