Skip to content

Commit 22cf4bd

Browse files
authored
Merge pull request #1060 from Parallel-in-Time/copilot/check-action-logs-issue
Fix ID mismatch crash when arXiv submission year differs from publication year
2 parents 16748e1 + 7fc3fc1 commit 22cf4bd

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

bin/arxiv_to_publications_correct.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@
3636
id = data['author'][0]['family'] + 'EtAl' + str(data['issued']['date-parts'][0][0])
3737
else:
3838
id = data['author'][0]['family'] + str(data['issued']['date-parts'][0][0])
39-
assert id == id_db, f"ID generated with new DOI ({id}) is different than the original in database ({id_db})"
39+
if id != id_db:
40+
print(f'Note: ID generated with new DOI ({id}) differs from the original in database ({id_db}). Keeping original ID.')
4041

4142
entries = db.get_entry_dict()
42-
assert entries[id]["ENTRYTYPE"] == 'unpublished', "original entry in bib file was NOT unpublished !"
43-
db.entries.remove(entries[id])
43+
assert entries[id_db]["ENTRYTYPE"] == 'unpublished', "original entry in bib file was NOT unpublished !"
44+
db.entries.remove(entries[id_db])
4445

4546
bType, *rest1 = bib.split("{")
4647
oldID, *rest2 = rest1[0].split(",")
47-
bib = "{".join([bType] + [','.join([id]+rest2)] + rest1[1:])
48+
bib = "{".join([bType] + [','.join([id_db]+rest2)] + rest1[1:])
4849
bib_db = bibtexparser.loads(bib)
4950
db.entries.extend(bib_db.get_entry_list())
5051

0 commit comments

Comments
 (0)