From cd3e89f2715ac3d655da05fb4d235b6a30ff1545 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 26 Nov 2024 14:25:38 -0800 Subject: [PATCH] fix: fixing a bug causing dictionaries to crash --- src/aind_qc_portal/panel/metric.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/aind_qc_portal/panel/metric.py b/src/aind_qc_portal/panel/metric.py index 0610a9c..08dbd75 100644 --- a/src/aind_qc_portal/panel/metric.py +++ b/src/aind_qc_portal/panel/metric.py @@ -131,8 +131,13 @@ def metric_panel(self): for v in value.values() ] ): + auto_value = True df = pd.DataFrame(value) value_widget = pn.pane.DataFrame(df) + elif all([isinstance(v, str) or isinstance(v, int) or isinstance(v, float) for v in value.values()]): + auto_value = True + df = pd.DataFrame([value]) + value_widget = pn.pane.DataFrame(df) else: try: custom_value = CustomMetricValue( @@ -159,10 +164,14 @@ def metric_panel(self): options=["Pass", "Fail", "Pending"], name="Metric status", ) - if auto_state: + + if pn.state.user == "guest": self.state_selector.disabled = True else: - self.state_selector.param.watch(self.set_status, "value") + if auto_state: + self.state_selector.disabled = True + else: + self.state_selector.param.watch(self.set_status, "value") header = pn.pane.Markdown(md)