aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/search.py
diff options
context:
space:
mode:
authorbnewbold <bnewbold@archive.org>2021-02-26 22:33:52 +0000
committerbnewbold <bnewbold@archive.org>2021-02-26 22:33:52 +0000
commitdf79a3dd9ffae5fcb8f32ea331c49ae4e9d998ed (patch)
tree1b4c4b589a43a36c0a11b578d6f4f96c3129213a /python/fatcat_web/search.py
parent67ee012ccc63ffcd98964ab58b2bcc49c5b6693a (diff)
parenta5e9309c148019539127f41d7fefd722d0ae3bf2 (diff)
downloadfatcat-df79a3dd9ffae5fcb8f32ea331c49ae4e9d998ed.tar.gz
fatcat-df79a3dd9ffae5fcb8f32ea331c49ae4e9d998ed.zip
Merge branch 'bnewbold-202102-tweaks' into 'master'
Feb 2021 web UI/UX tweaks See merge request webgroup/fatcat!96
Diffstat (limited to 'python/fatcat_web/search.py')
-rw-r--r--python/fatcat_web/search.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py
index 755b303a..6a419fa8 100644
--- a/python/fatcat_web/search.py
+++ b/python/fatcat_web/search.py
@@ -738,11 +738,12 @@ def get_elastic_container_preservation_by_volume(container_id: str) -> List[dict
buckets = resp.aggregations.volume_preservation.buckets
volume_nums = set([int(h['key']['volume']) for h in buckets if h['key']['volume'].isdigit()])
volume_dicts = dict()
- for num in range(min(volume_nums), max(volume_nums)+1):
- volume_dicts[num] = dict(volume=num, bright=0, dark=0, shadows_only=0, none=0)
- for row in buckets:
- if row['key']['volume'].isdigit():
- volume_dicts[int(row['key']['volume'])][row['key']['preservation']] = int(row['doc_count'])
+ if volume_nums:
+ for num in range(min(volume_nums), max(volume_nums)+1):
+ volume_dicts[num] = dict(volume=num, bright=0, dark=0, shadows_only=0, none=0)
+ for row in buckets:
+ if row['key']['volume'].isdigit():
+ volume_dicts[int(row['key']['volume'])][row['key']['preservation']] = int(row['doc_count'])
if app.config['FATCAT_MERGE_SHADOW_PRESERVATION']:
for k in volume_dicts.keys():
volume_dicts[k]['none'] += volume_dicts[k]['shadows_only']