Skip to content

Commit

Permalink
fix premature clock start on broadcast previews
Browse files Browse the repository at this point in the history
when the `WhiteClock` tag is set
  • Loading branch information
ornicar committed Dec 26, 2024
1 parent 55382f4 commit a9a7594
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ui/analyse/src/study/multiBoard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export const renderClock = (chapter: ChapterPreview, color: Color) => {
const computeTimeLeft = (preview: ChapterPreview, color: Color): number | undefined => {
const clock = preview.players?.[color]?.clock;
if (notNull(clock)) {
if (defined(preview.lastMoveAt) && fenColor(preview.fen) === color) {
if (defined(preview.lastMoveAt) && defined(preview.lastMove) && fenColor(preview.fen) === color) {
const spent = (Date.now() - preview.lastMoveAt) / 1000;
return Math.max(0, clock / 100 - spent);
} else {
Expand Down

0 comments on commit a9a7594

Please sign in to comment.