Skip to content

Commit

Permalink
lns: remove pub_year restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
drjova committed Feb 12, 2024
1 parent fd7d268 commit 676e940
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Library-Notification-Service/src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@
NOTIFICATIONS_API_URL,
NOTIFICATIONS_CHANNEL_ID,
)
from .utils import (
get_full_query,
get_last_five_years_range,
get_last_week_date_range,
get_pids_from_docs,
)
from .utils import get_full_query, get_last_week_date_range, get_pids_from_docs


def get_library_catalogue_backoffice_urls() -> List[str]:
Expand Down Expand Up @@ -69,17 +64,14 @@ def get_catalogue_site_url(query: str) -> str:


def get_results_from_pids(pids: List[str], subjects: List[str]) -> List[dict]:
published = get_last_five_years_range()
results = []

# divide pids into chunks of 40 to reduce query size
for i in range(0, len(pids), 40):
chunked_pids = pids[i : i + 40]
if not chunked_pids:
continue
catalogue_site_query = get_full_query(
pid=chunked_pids, pub_year=published, subject=subjects
)
catalogue_site_query = get_full_query(pid=chunked_pids, subject=subjects)
result = get_site_api_docs(catalogue_site_query)
results.extend(result)

Expand Down

0 comments on commit 676e940

Please sign in to comment.