Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
ee6f8b28
Commit
ee6f8b28
authored
Jan 12, 2021
by
LE GAC Renaud
Browse files
Update wizards.update_citations to use 'citation_count'
parent
a1568400
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
controllers/wizards.py
controllers/wizards.py
+6
-6
No files found.
controllers/wizards.py
View file @
ee6f8b28
...
...
@@ -437,10 +437,10 @@ def update_citations():
from
json.decoder
import
JSONDecodeError
from
reporting_tools
import
repr_team_project
from
store_tools
import
CdsException
,
In
venio
Store
from
store_tools
import
CdsException
,
In
spirehep
Store
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
=
In
venio
Store
(
"inspirehep.net"
,
shelf
=
"literature"
)
store
=
In
spirehep
Store
(
"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_
citation
s
"
)
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment