Skip to content

Commit

Permalink
Fix results DNF/DNS quirk
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg committed Feb 5, 2025
1 parent f2ced0c commit e299904
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions app/webpacker/components/Results/TableColumns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,24 @@ import {
} from './TableCells';

function resultAttempts(result) {
const attempts = [result?.value1, result?.value2, result?.value3, result?.value4, result?.value5]
.filter(Boolean);
const definedAttempts = [
result?.value1,
result?.value2,
result?.value3,
result?.value4,
result?.value5,
].filter((res) => res !== undefined);

const bestResult = _.max(attempts);
const worstResult = _.min(attempts);
const validAttempts = definedAttempts.filter((res) => res !== 0);
const completedAttempts = validAttempts.filter((res) => res > 0);

const bestResultIndex = attempts.indexOf(bestResult);
const worstResultIndex = attempts.indexOf(worstResult);
const worstResult = _.max(completedAttempts);
const bestResult = _.min(completedAttempts);

return [attempts, bestResultIndex, worstResultIndex];
const bestResultIndex = definedAttempts.indexOf(bestResult);
const worstResultIndex = definedAttempts.indexOf(worstResult);

return [definedAttempts, bestResultIndex, worstResultIndex];
}

export const resultsFiveWideColumn = {
Expand Down

0 comments on commit e299904

Please sign in to comment.