Commit ee6f8b28 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update wizards.update_citations to use 'citation_count'

parent a1568400
......@@ -437,10 +437,10 @@ def update_citations():
from json.decoder import JSONDecodeError
from reporting_tools import repr_team_project
from store_tools import CdsException, InvenioStore
from store_tools import CdsException, InspirehepStore
today = datetime.date.today()
rex_ins = re.compile(r"https?://inspirehep.net/record/(\d+)")
rex_ins = re.compile(r"inspirehep.net/record/(\d+)")
citations = db.citations
publications = db.publications
......@@ -461,7 +461,7 @@ def update_citations():
query = selector.query(publications)
# get the number of citation and update the database table
store = InvenioStore("inspirehep.net", shelf="literature")
store = InspirehepStore("inspirehep.net", shelf="literature")
for row in db(query).iterselect(publications.id, publications.origin):
counters.article += 1
......@@ -470,15 +470,15 @@ def update_citations():
# interrogate inspirehep.net
try:
recid = rex_ins.search(row.origin).group(1)
count = store.get_field(recid, "number_of_citations")
count = store.get_field(recid, "citation_count")
except AttributeError:
logger.warning(f"record identifier not found in {row.origin}")
counters.recid += 1
continue
except CdsException:
logger.warning(f"failed to get citations for {recid}")
except CdsException as e:
logger.warning(f"failed to get citations for {recid}: {e}")
counters.failed += 1
continue
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment