From d1dc73e14cf089616e9d8ffffb5c3df97ed44229 Mon Sep 17 00:00:00 2001 From: c-bata Date: Mon, 22 Feb 2021 23:08:35 +0900 Subject: [PATCH] Fix a bug that zero objective value is not shown --- optuna_dashboard/static/components/StudyDetail.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/optuna_dashboard/static/components/StudyDetail.tsx b/optuna_dashboard/static/components/StudyDetail.tsx index 6847be4f..d4633889 100644 --- a/optuna_dashboard/static/components/StudyDetail.tsx +++ b/optuna_dashboard/static/components/StudyDetail.tsx @@ -235,7 +235,12 @@ const TrialTable: FC<{ studyDetail: StudyDetail | null }> = ({ } return trials[i].values![0] < trials[j].values![0] ? 1 : -1 }, - toCellValue: (i) => trials[i].values?.[0] || null, + toCellValue: (i) => { + if (trials[i].values === undefined) { + return null + } + return trials[i].values?.[0] + }, }) } else { const objectiveColumns: DataGridColumn< @@ -258,7 +263,12 @@ const TrialTable: FC<{ studyDetail: StudyDetail | null }> = ({ ? 1 : -1 }, - toCellValue: (i) => trials[i].values?.[objectiveId] || null, + toCellValue: (i) => { + if (trials[i].values === undefined) { + return null + } + return trials[i].values?.[objectiveId] + }, })) columns.push(...objectiveColumns) }