This commit is contained in:
Joachim 2021-12-21 11:58:46 +01:00
parent 4d6c4d3ad2
commit da51711ddf
2 changed files with 11 additions and 3 deletions

View file

@ -478,5 +478,9 @@ urlpatterns = [
r"^ostatus_success/?$", views.ostatus_follow_success, name="ostatus-success" r"^ostatus_success/?$", views.ostatus_follow_success, name="ostatus-success"
), ),
# annual summary # annual summary
re_path(r"^my-year-in-the-books/(?P<year>\d{4})/?$", views.AnnualSummary.as_view(), name="annual-summary"), re_path(
r"^my-year-in-the-books/(?P<year>\d{4})/?$",
views.AnnualSummary.as_view(),
name="annual-summary",
),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View file

@ -22,7 +22,11 @@ def get_annual_summary_year():
if today >= date(today.year, 12, FIRST_DAY) and today <= date(today.year, 12, 31): if today >= date(today.year, 12, FIRST_DAY) and today <= date(today.year, 12, 31):
return today.year return today.year
if LAST_DAY > 0 and today >= date(today.year, 1, 1) and today <= date(today.year, 1, LAST_DAY): if (
LAST_DAY > 0
and today >= date(today.year, 1, 1)
and today <= date(today.year, 1, LAST_DAY)
):
return today.year - 1 return today.year - 1
return None return None
@ -52,7 +56,7 @@ class AnnualSummary(View):
paginated_years = ( paginated_years = (
int(year) - 1, int(year) - 1,
int(year) + 1 if is_year_available(int(year) + 1) else None int(year) + 1 if is_year_available(int(year) + 1) else None,
) )
user = request.user user = request.user