Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 7x 3x 14x 3x 4x 4x | import { COMPLETED } from 'data/constants';
export function calculateScore(values) {
if (!values.length) return 0;
const completedCount = values.reduce((sum, value) => {
return value === COMPLETED ? sum + 1 : sum;
}, 0);
return Math.floor((completedCount / values.length) * 100);
}
export function createPieChartData(values) {
const score = calculateScore(values);
return [
{
id: 'value',
value: score,
},
{
id: 'empty',
value: 100 - score,
},
];
}
|