Skip to content
This repository was archived by the owner on Jan 3, 2025. It is now read-only.

Show Minutes and Seconds in Cutoff #462

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Frontend/src/pages/events/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ import { CompetitionContext } from '../../api/helper/context/competition_context
import { setMessage } from '../../ui/events/messages'
import LoadingMessage from '../../ui/messages/loadingMessage'

function centiSecondsToHumanReadable(centiSeconds) {
const seconds = centiSeconds / 100
if (seconds < 60) {
return `${seconds} seconds`
}
const minutes = Math.floor(seconds / 60)
return `${minutes}:${(seconds % 60).toString().padStart(2, '0')}`
}

export default function Events() {
const { competitionInfo } = useContext(CompetitionContext)

Expand Down Expand Up @@ -73,12 +82,14 @@ export default function Events() {
<TableCell>{getFormatName(round.format)}</TableCell>
<TableCell>
{round.timeLimit &&
`${round.timeLimit.centiseconds / 100} seconds`}
centiSecondsToHumanReadable(round.timeLimit.centiseconds)}
</TableCell>
{competitionInfo['uses_cutoff?'] && (
<TableCell>
{round.cutoff &&
`${round.cutoff?.attemptResult / 100} seconds`}
centiSecondsToHumanReadable(
round.timeLimit.centiseconds
)}
</TableCell>
)}
<TableCell>
Expand Down