Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent 24618a9 commit 81008ff
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/combination/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { getMean } from '../stats/sum.js'

import { COMBINATION_DIMENSIONS } from './dimensions.js'

// Add `combination.*Rank` then sort combinations based on it.
// Add `combination.*Rank` for each dimension based on `stat.mean`.
// Then sort combinations based on it.
export const groupResultCombinations = function (result) {
const combinations = COMBINATION_DIMENSIONS.reduce(
addDimensionInfo,
result.combinations,
)
const combinationsA = sortCombinations(combinations)
const combinationsA = sortOn(combinations, SORT_ORDER)
return { ...result, combinations: combinationsA }
}

Expand Down Expand Up @@ -58,10 +59,4 @@ const addRank = function ({ combination, dimension, idName, rankName }) {
return { ...combination, [rankName]: rankValue }
}

// Sort combinations so the fastest tasks will be first, then the fastest
// combinations within each task (regardless of column)
const sortCombinations = function (combinations) {
return sortOn(combinations, SORT_ORDER)
}

const SORT_ORDER = ['taskRank', 'runnerRank', 'systemRank']

0 comments on commit 81008ff

Please sign in to comment.