From 4a7764e4024a031a383775bc03c625b716797624 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Tue, 10 Sep 2024 23:05:55 -0400 Subject: [PATCH] Only list computable plot columns if there are other numeric columns --- CHANGELOG.md | 6 ++++++ .../utils/__init__.py | 15 ++++++++------- .../test_annotation/test_annotations_rest.py | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d19a1d58a..ff4228b07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 1.29.10 + +### Improvements + +- Only list computable plot columns if there are other numeric columns ([#1634](../../pull/1634)) + ## 1.29.9 ### Bug Fixes diff --git a/girder_annotation/girder_large_image_annotation/utils/__init__.py b/girder_annotation/girder_large_image_annotation/utils/__init__.py index 2edb91168..6c9cd86f5 100644 --- a/girder_annotation/girder_large_image_annotation/utils/__init__.py +++ b/girder_annotation/girder_large_image_annotation/utils/__init__.py @@ -1128,13 +1128,14 @@ def computeSelectorAxis(record, data, row): return computeSelectorAxis if not self._datacolumns: - for key in self.computeColumns: - title = self.commonColumns[key] - self._ensureColumn( - columns, key, title, 'compute', computeGetData, - computeSelector(key), computeLength) - columns[key]['count'] = 1 - columns[key]['min'] = columns[key]['max'] = 0 + if len([col for col in columns.values() if col['type'] == 'number']) >= 2: + for key in self.computeColumns: + title = self.commonColumns[key] + self._ensureColumn( + columns, key, title, 'compute', computeGetData, + computeSelector(key), computeLength) + columns[key]['count'] = 1 + columns[key]['min'] = columns[key]['max'] = 0 return 0 if self._compute is None or not len(self._requiredColumns & self.computeColumns): return 0 diff --git a/girder_annotation/test_annotation/test_annotations_rest.py b/girder_annotation/test_annotation/test_annotations_rest.py index 49e930f63..190f322e1 100644 --- a/girder_annotation/test_annotation/test_annotations_rest.py +++ b/girder_annotation/test_annotation/test_annotations_rest.py @@ -866,7 +866,7 @@ def testPlottableEndpoints(self, server, admin): }, ) assert utilities.respStatus(resp) == 200 - assert len(resp.json) == 5 + assert len(resp.json) == 2 resp = server.request( path=f'/annotation/item/{itemSrc["_id"]}/plot/list', @@ -877,7 +877,7 @@ def testPlottableEndpoints(self, server, admin): }, ) assert utilities.respStatus(resp) == 200 - assert len(resp.json) >= 8 + assert len(resp.json) >= 5 resp = server.request( path=f'/annotation/item/{itemSrc["_id"]}/plot/data',