summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/entity_helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web/entity_helpers.py')
-rw-r--r--python/fatcat_web/entity_helpers.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py
index b36307a1..d6a6eb26 100644
--- a/python/fatcat_web/entity_helpers.py
+++ b/python/fatcat_web/entity_helpers.py
@@ -3,7 +3,7 @@ from flask import abort
from fatcat_client.rest import ApiException
from fatcat_tools.transforms import *
from fatcat_web import app, api
-from fatcat_web.search import get_elastic_container_stats
+from fatcat_web.search import get_elastic_container_stats, get_elastic_container_random_releases
from fatcat_web.hacks import strip_extlink_xml, wayback_suffix
def enrich_container_entity(entity):
@@ -12,12 +12,13 @@ def enrich_container_entity(entity):
if entity.state == "active":
entity._es = container_to_elasticsearch(entity, force_bool=False)
entity._stats = None
- if entity.issnl:
- try:
- entity._stats = get_elastic_container_stats(entity.ident, issnl=entity.issnl)
- except Exception as e:
- app.log.error(e)
- pass
+ try:
+ entity._stats = get_elastic_container_stats(entity.ident, issnl=entity.issnl)
+ #if entity._stats['total'] > 0:
+ entity._random_releases = get_elastic_container_random_releases(entity.ident)
+ except Exception as e:
+ app.log.error(e)
+ pass
return entity
def enrich_creator_entity(entity):