Skip to content

Commit

Permalink
fix(statistics): Fulfilled priorities were not computed correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorndown committed Feb 11, 2024
1 parent 12250e4 commit 8372ec2
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/components/Statistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ export const Statistics: FunctionComponent<Props> = ({
result,
particpantsConfig
}) => {
const getXLabel = (priority: number) => `${priority + 1}. Priorität`
const computePriorityDistribution = (results: MatchResult): number[] => {
const distribution: Record<string, number> = {}
for (const activity of results.activities) {
for (const execution of _range(1)) {
for (const participant of activity.allParticipants()) {
const fullfilledPriority = participant.priorities.indexOf(
activity.id
)
if (!distribution[getXLabel(fullfilledPriority)]) {
distribution[getXLabel(fullfilledPriority)] = 1
} else {
distribution[getXLabel(fullfilledPriority)]++
}
for (const participant of activity.allParticipants()) {
const fulfilledPriority = participant.priorities.indexOf(
activity.id
)
if (!distribution[fulfilledPriority]) {
distribution[fulfilledPriority] = 1
} else {
distribution[fulfilledPriority]++
}
}
}
Expand Down

0 comments on commit 8372ec2

Please sign in to comment.