Skip to content

Commit

Permalink
Merge pull request #450 from arXiv/ARXIVCE-1069-bugfix-archives-with-…
Browse files Browse the repository at this point in the history
…end-years

years_operating now alwasy tries to add just the year of dates
  • Loading branch information
kyokukou authored Dec 22, 2023
2 parents 730c2b7 + 20bc295 commit ded8aed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion browse/controllers/years_operating.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def years_operating(archive: Dict[str, Any]) -> List[int]:
):
return []
start = archive["start_date"].year
end = archive.get("end_date", None) or date.today().year
end = archive.get("end_date", date.today()).year #end date could be None or a date
return list(reversed(range(start, end + 1)))


Expand Down
8 changes: 8 additions & 0 deletions tests/test_list_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,3 +647,11 @@ def test_math_ph_9701(client_with_test_fs):
text = rv.text
assert "On Exact Solutions" in text
assert "unknown-id" not in text

def test_year_archive_with_end_date(client_with_test_fs):
client = client_with_test_fs
rv = client.get("/year/funct-an")
assert rv.status_code == 200
text=rv.text
assert '<a href="/year/funct-an/97">1997</a>' in text
assert '<a href="/year/funct-an/98">1998</a>' not in text

0 comments on commit ded8aed

Please sign in to comment.