feat: 优化get_abstract_from_elsevier
This commit is contained in:
parent
5529f97ab8
commit
b0f7f18d18
|
|
@ -68,7 +68,7 @@ def get_abstract_from_elsevier(publication_year: int = None, number_of_task:int
|
|||
qs = qs.filter(publication_year=publication_year)
|
||||
qs = qs.exclude(
|
||||
fail_reason="elsevier_doi_not_found"
|
||||
).order_by("publication_date")
|
||||
).order_by("-publication_date")
|
||||
|
||||
if not qs.exists():
|
||||
return "done"
|
||||
|
|
@ -146,16 +146,12 @@ def get_abstract_from_elsevier(publication_year: int = None, number_of_task:int
|
|||
paper.fail_reason = "elsevier_doi_not_found"
|
||||
paper.save(update_fields=["fail_reason"])
|
||||
|
||||
remaining_count = qs.count()
|
||||
if remaining_count == 0:
|
||||
return "done"
|
||||
else:
|
||||
current_app.send_task(
|
||||
"apps.resm.tasks.get_abstract_from_elsevier",
|
||||
kwargs={
|
||||
"publication_year": publication_year,
|
||||
"number_of_task": number_of_task,
|
||||
},
|
||||
countdown=5,
|
||||
)
|
||||
return f'{err_msg}, remaining {remaining_count} papers'
|
||||
current_app.send_task(
|
||||
"apps.resm.tasks.get_abstract_from_elsevier",
|
||||
kwargs={
|
||||
"publication_year": publication_year,
|
||||
"number_of_task": number_of_task,
|
||||
},
|
||||
countdown=5,
|
||||
)
|
||||
return f'{err_msg}, remaining {qs.count()} papers'
|
||||
Loading…
Reference in New Issue