Skip to content

Commit

Permalink
Merge branch 'master' into feature/scenario-settings-median
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeknovy committed Sep 8, 2023
2 parents 4880a21 + 4f0853b commit 81f9b81
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"moment": "^2.29.4",
"multer": "^1.4.5-lts.1",
"node-pg-migrate": "^6.2.2",
"pg": "^8.11.2",
"pg": "^8.11.3",
"pg-promise": "^10.15.4",
"swagger-ui-express": "^4.6.3",
"uuid": "^9.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ export const getScenarioTrendsController = async (req: IGetUserAuthInfoRequest,
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 @@ export const getScenarioTrendsController = async (req: IGetUserAuthInfoRequest,
})
})


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

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

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()

}

0 comments on commit 81f9b81

Please sign in to comment.