From 1a682753c0f126a8319389397d7558d88183b989 Mon Sep 17 00:00:00 2001 From: Rohan Sureshkumar Date: Tue, 9 Jan 2024 15:31:05 +0530 Subject: [PATCH 1/4] Issue-3187: changes --- bookwyrm/templates/feed/feed.html | 2 +- bookwyrm/views/feed.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bookwyrm/templates/feed/feed.html b/bookwyrm/templates/feed/feed.html index 7ecf10b70..820314b7a 100644 --- a/bookwyrm/templates/feed/feed.html +++ b/bookwyrm/templates/feed/feed.html @@ -33,7 +33,7 @@ - {% if request.user.show_goal and not goal and tab.key == 'home' %} + {% if request.user.show_goal and not goal and tab.key == 'home' and has_read_throughs %} {% now 'Y' as year %}
{% include 'feed/goal_card.html' with year=year %} diff --git a/bookwyrm/views/feed.py b/bookwyrm/views/feed.py index 17218b93e..381d233e9 100644 --- a/bookwyrm/views/feed.py +++ b/bookwyrm/views/feed.py @@ -52,6 +52,8 @@ class Feed(View): suggestions = suggested_users.get_suggestions(request.user) + readthroughs = models.ReadThrough.objects.filter(user=request.user) + data = { **feed_page_data(request.user), **{ @@ -66,6 +68,7 @@ class Feed(View): "path": f"/{tab['key']}", "annual_summary_year": get_annual_summary_year(), "has_tour": True, + "has_read_throughs": True if len(readthroughs) else False, }, } return TemplateResponse(request, "feed/feed.html", data) From 5ef104b802dce740835f4a34bb4403459e2791bc Mon Sep 17 00:00:00 2001 From: Rohan Sureshkumar Date: Mon, 15 Jan 2024 17:22:33 +0530 Subject: [PATCH 2/4] Issue-3187: addressing review comments --- bookwyrm/templates/feed/feed.html | 4 ++-- bookwyrm/views/feed.py | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bookwyrm/templates/feed/feed.html b/bookwyrm/templates/feed/feed.html index 820314b7a..56c380202 100644 --- a/bookwyrm/templates/feed/feed.html +++ b/bookwyrm/templates/feed/feed.html @@ -33,7 +33,7 @@ - {% if request.user.show_goal and not goal and tab.key == 'home' and has_read_throughs %} + {% if request.user.show_goal and not goal and tab.key == 'home' %} {% now 'Y' as year %}
{% include 'feed/goal_card.html' with year=year %} @@ -41,7 +41,7 @@
{% endif %} - {% if annual_summary_year and tab.key == 'home' %} + {% if annual_summary_year and tab.key == 'home' and has_read_throughs %} {% endif %} - {% if annual_summary_year and tab.key == 'home' and has_read_throughs %} + {% if annual_summary_year and tab.key == 'home' and has_summary_read_throughs %}