Skip to content

Commit

Permalink
Cyberleague: [premieroctet#159] compute res in statistics.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien-Wappizy committed Oct 7, 2024
1 parent 84271a7 commit 9312a42
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backend/web/server/plugins/cyberleague/statistic.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const computeBellwetherStatistics = async (filters) => {
{path: 'answers', populate: {path: 'question', $match: {is_bellwether: true}, populate: {path: 'text'}}}
])

const res = {
let res = {
securityIncidentManagement: 0,
partner: 0,
inventory: 0,
Expand Down Expand Up @@ -180,7 +180,11 @@ const computeBellwetherStatistics = async (filters) => {
})

//Compute ratios for bellwether

res.forEach((_,k) => {
res[k] = Math.round(bellwetherData[k].value / bellwetherData[k].count * 100) /100
})

return res
}

module.exports = {
Expand Down

0 comments on commit 9312a42

Please sign in to comment.