Modified the front-end to display averaged results up to two decimals
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -1,3 +1,21 @@
|
||||
$ ->
|
||||
# run foundation scripts
|
||||
console.log('Ready.')
|
||||
|
||||
averageResults = (results, decimals = 2) ->
|
||||
avgScore = 0
|
||||
minScore = Infinity
|
||||
maxScore = -Infinity
|
||||
|
||||
factor = (10 ^ decimals)
|
||||
|
||||
for result in results
|
||||
avgScore += result.avg_score
|
||||
minScore = Math.min(minScore, result.min_score)
|
||||
maxScore = Math.max(maxScore, result.max_score)
|
||||
|
||||
return {
|
||||
avgScore: Math.round((avgScore / results.length) * factor) / factor,
|
||||
minScore: minScore,
|
||||
maxScore: maxScore,
|
||||
}
|
||||
|
Reference in New Issue
Block a user