From 059f4751acc17387eabd723f5caa547b29be63d2 Mon Sep 17 00:00:00 2001 From: nabenabe0928 Date: Tue, 12 Dec 2023 13:32:42 +0100 Subject: [PATCH] Apply formatter --- .../ts/components/GraphTimeline.tsx | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/optuna_dashboard/ts/components/GraphTimeline.tsx b/optuna_dashboard/ts/components/GraphTimeline.tsx index 29449a9d..dfb97bc6 100644 --- a/optuna_dashboard/ts/components/GraphTimeline.tsx +++ b/optuna_dashboard/ts/components/GraphTimeline.tsx @@ -66,32 +66,33 @@ const plotTimeline = (trials: Trial[], mode: string) => { ) ) const maxRunDuration = Math.max( - ...lastTrials.map( - (t) => { - const start = t.datetime_start?.getTime() ?? new Date().getTime() - const complete = t.datetime_complete?.getTime() ?? start - return complete - start - } - ) + ...lastTrials.map((t) => { + const start = t.datetime_start?.getTime() ?? new Date().getTime() + const complete = t.datetime_complete?.getTime() ?? start + return complete - start + }) ) - const hasRunning = maxRunDuration === 0 || lastTrials.some((t) => { + const hasRunning = + maxRunDuration === 0 || + lastTrials.some((t) => { const isRunning = t.state === "Running" - if (!isRunning){ + if (!isRunning) { return false } const start = t.datetime_start?.getTime() ?? new Date().getTime() const now = new Date().getTime() // This is an ad-hoc handling to check if the trial is running. return now - start < maxRunDuration * 5 - } - ) - const maxDatetime = hasRunning ? new Date() : new Date( - Math.max( - ...lastTrials.map( - (t) => t.datetime_complete?.getTime() ?? minDatetime.getTime() + }) + const maxDatetime = hasRunning + ? new Date() + : new Date( + Math.max( + ...lastTrials.map( + (t) => t.datetime_complete?.getTime() ?? minDatetime.getTime() + ) + ) ) - ) - ) const layout: Partial = { margin: { l: 50,