Skip to content

Commit

Permalink
Use means for sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 5, 2021
1 parent e053163 commit ef20c22
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/combination/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,27 @@ const getDimensionIds = function (combinations, idName) {
}

const getDimension = function ({ combinations, id, idName }) {
const medians = combinations
const means = combinations
.filter((combination) => combination[idName] === id)
.map(getCombinationMedian)
.map(getCombinationMean)
.filter(isDefined)

if (medians.length === 0) {
if (means.length === 0) {
return { id }
}

const mean = getMean(medians)
const mean = getMean(means)
return { id, mean }
}

const getCombinationMedian = function ({ stats: { median } }) {
return median
const getCombinationMean = function ({ stats: { mean } }) {
return mean
}

// `median` is `undefined` when in preview mode on combinations not measured yet
// `mean` is `undefined` when in preview mode on combinations not measured yet
// `dimension.mean` will be `undefined`, which is sorted last.
const isDefined = function (median) {
return median !== undefined
const isDefined = function (mean) {
return mean !== undefined
}

// Add speed rank within each dimension for each combination
Expand Down

0 comments on commit ef20c22

Please sign in to comment.