From 443750d6dbf381264b74654ddc64252d5f04d791 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 09:14:04 -0700 Subject: [PATCH 01/19] f strings for activistreams tasks tests --- bookwyrm/tests/activitystreams/test_tasks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bookwyrm/tests/activitystreams/test_tasks.py b/bookwyrm/tests/activitystreams/test_tasks.py index f4c85e1bf..1002e4a8a 100644 --- a/bookwyrm/tests/activitystreams/test_tasks.py +++ b/bookwyrm/tests/activitystreams/test_tasks.py @@ -141,7 +141,7 @@ class Activitystreams(TestCase): call_args = mock.call_args self.assertEqual(call_args[0][0], status) self.assertEqual( - call_args[1]["stores"], ["{:d}-home".format(self.another_user.id)] + call_args[1]["stores"], [f"{self.another_user.id}-home"] ) @patch("bookwyrm.activitystreams.LocalStream.remove_object_from_related_stores") @@ -164,10 +164,10 @@ class Activitystreams(TestCase): call_args = mock.call_args self.assertEqual(call_args[0][0], status) self.assertTrue( - "{:d}-home".format(self.another_user.id) in call_args[1]["stores"] + f"{self.another_user.id}-home" in call_args[1]["stores"] ) self.assertTrue( - "{:d}-home".format(self.local_user.id) in call_args[1]["stores"] + f"{self.local_user.id}-home" in call_args[1]["stores"] ) @patch("bookwyrm.activitystreams.LocalStream.remove_object_from_related_stores") @@ -189,5 +189,5 @@ class Activitystreams(TestCase): call_args = mock.call_args self.assertEqual(call_args[0][0], status) self.assertEqual( - call_args[1]["stores"], ["{:d}-home".format(self.local_user.id)] + call_args[1]["stores"], [f"{self.local_user.id}-home"] ) From 321949f2fac201ebf66b0cd480e151f63f377769 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 09:47:33 -0700 Subject: [PATCH 02/19] Lightly updates tests --- bookwyrm/activitystreams.py | 2 ++ bookwyrm/redis_store.py | 2 +- bookwyrm/tests/activitystreams/test_tasks.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bookwyrm/activitystreams.py b/bookwyrm/activitystreams.py index 1feb495b7..f843641f5 100644 --- a/bookwyrm/activitystreams.py +++ b/bookwyrm/activitystreams.py @@ -480,12 +480,14 @@ def handle_boost_task(boost_id): instance = models.Status.objects.get(id=boost_id) boosted = instance.boost.boosted_status + # previous boosts of this status old_versions = models.Boost.objects.filter( boosted_status__id=boosted.id, created_date__lt=instance.created_date, ) for stream in streams.values(): + # people who should see the boost (not people who see the original status) audience = stream.get_stores_for_object(instance) stream.remove_object_from_related_stores(boosted, stores=audience) for status in old_versions: diff --git a/bookwyrm/redis_store.py b/bookwyrm/redis_store.py index 521e73b26..78f373a2e 100644 --- a/bookwyrm/redis_store.py +++ b/bookwyrm/redis_store.py @@ -35,7 +35,7 @@ class RedisStore(ABC): def remove_object_from_related_stores(self, obj, stores=None): """remove an object from all stores""" - stores = stores or self.get_stores_for_object(obj) + stores = self.get_stores_for_object(obj) if stores is None else stores pipeline = r.pipeline() for store in stores: pipeline.zrem(store, -1, obj.id) diff --git a/bookwyrm/tests/activitystreams/test_tasks.py b/bookwyrm/tests/activitystreams/test_tasks.py index 1002e4a8a..887047830 100644 --- a/bookwyrm/tests/activitystreams/test_tasks.py +++ b/bookwyrm/tests/activitystreams/test_tasks.py @@ -125,7 +125,7 @@ class Activitystreams(TestCase): @patch("bookwyrm.activitystreams.BooksStream.remove_object_from_related_stores") @patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") def test_boost_to_another_timeline(self, *_): - """add a boost and deduplicate the boosted status on the timeline""" + """boost from a non-follower doesn't remove original status from feed""" status = models.Status.objects.create(user=self.local_user, content="hi") with patch("bookwyrm.activitystreams.handle_boost_task.delay"): boost = models.Boost.objects.create( @@ -138,6 +138,7 @@ class Activitystreams(TestCase): activitystreams.handle_boost_task(boost.id) self.assertTrue(mock.called) + self.assertEqual(mock.call_count, 1) call_args = mock.call_args self.assertEqual(call_args[0][0], status) self.assertEqual( From ac70a810af9cf5136baf63525d34b8a607e8b447 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 09:58:05 -0700 Subject: [PATCH 03/19] Boosts by remote users --- bookwyrm/tests/activitystreams/test_tasks.py | 48 +++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/bookwyrm/tests/activitystreams/test_tasks.py b/bookwyrm/tests/activitystreams/test_tasks.py index 887047830..80b0b771d 100644 --- a/bookwyrm/tests/activitystreams/test_tasks.py +++ b/bookwyrm/tests/activitystreams/test_tasks.py @@ -22,6 +22,16 @@ class Activitystreams(TestCase): local=True, localname="nutria", ) + with patch("bookwyrm.models.user.set_remote_server.delay"): + self.remote_user = models.User.objects.create_user( + "rat", + "rat@rat.com", + "ratword", + local=False, + remote_id="https://example.com/users/rat", + inbox="https://example.com/users/rat/inbox", + outbox="https://example.com/users/rat/outbox", + ) work = models.Work.objects.create(title="test work") self.book = models.Edition.objects.create(title="test book", parent_work=work) with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): @@ -141,9 +151,29 @@ class Activitystreams(TestCase): self.assertEqual(mock.call_count, 1) call_args = mock.call_args self.assertEqual(call_args[0][0], status) - self.assertEqual( - call_args[1]["stores"], [f"{self.another_user.id}-home"] - ) + self.assertEqual(call_args[1]["stores"], [f"{self.another_user.id}-home"]) + + @patch("bookwyrm.activitystreams.LocalStream.remove_object_from_related_stores") + @patch("bookwyrm.activitystreams.BooksStream.remove_object_from_related_stores") + @patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") + def test_boost_to_another_timeline_remote(self, *_): + """boost from a remote non-follower doesn't remove original status from feed""" + status = models.Status.objects.create(user=self.local_user, content="hi") + with patch("bookwyrm.activitystreams.handle_boost_task.delay"): + boost = models.Boost.objects.create( + boosted_status=status, + user=self.remote_user, + ) + with patch( + "bookwyrm.activitystreams.HomeStream.remove_object_from_related_stores" + ) as mock: + activitystreams.handle_boost_task(boost.id) + + self.assertTrue(mock.called) + self.assertEqual(mock.call_count, 1) + call_args = mock.call_args + self.assertEqual(call_args[0][0], status) + self.assertEqual(call_args[1]["stores"], []) @patch("bookwyrm.activitystreams.LocalStream.remove_object_from_related_stores") @patch("bookwyrm.activitystreams.BooksStream.remove_object_from_related_stores") @@ -164,12 +194,8 @@ class Activitystreams(TestCase): self.assertTrue(mock.called) call_args = mock.call_args self.assertEqual(call_args[0][0], status) - self.assertTrue( - f"{self.another_user.id}-home" in call_args[1]["stores"] - ) - self.assertTrue( - f"{self.local_user.id}-home" in call_args[1]["stores"] - ) + self.assertTrue(f"{self.another_user.id}-home" in call_args[1]["stores"]) + self.assertTrue(f"{self.local_user.id}-home" in call_args[1]["stores"]) @patch("bookwyrm.activitystreams.LocalStream.remove_object_from_related_stores") @patch("bookwyrm.activitystreams.BooksStream.remove_object_from_related_stores") @@ -189,6 +215,4 @@ class Activitystreams(TestCase): self.assertTrue(mock.called) call_args = mock.call_args self.assertEqual(call_args[0][0], status) - self.assertEqual( - call_args[1]["stores"], [f"{self.local_user.id}-home"] - ) + self.assertEqual(call_args[1]["stores"], [f"{self.local_user.id}-home"]) From 2a88753e17cf094e6c54f09b39fbc1ef0e1dee3d Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 10:40:39 -0700 Subject: [PATCH 04/19] Chart class --- bookwyrm/views/admin/dashboard.py | 82 +++++++++++++++++++------------ 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/bookwyrm/views/admin/dashboard.py b/bookwyrm/views/admin/dashboard.py index e02b9143e..66dd9c90f 100644 --- a/bookwyrm/views/admin/dashboard.py +++ b/bookwyrm/views/admin/dashboard.py @@ -25,13 +25,6 @@ class Dashboard(View): """list of users""" interval = int(request.GET.get("days", 1)) now = timezone.now() - - user_queryset = models.User.objects.filter(local=True) - user_stats = {"labels": [], "total": [], "active": []} - - status_queryset = models.Status.objects.filter(user__local=True, deleted=False) - status_stats = {"labels": [], "total": []} - start = request.GET.get("start") if start: start = timezone.make_aware(parse(start)) @@ -42,31 +35,33 @@ class Dashboard(View): end = timezone.make_aware(parse(end)) if end else now start = start.replace(hour=0, minute=0, second=0) - interval_start = start - interval_end = interval_start + timedelta(days=interval) - while interval_start <= end: - print(interval_start, interval_end) - interval_queryset = user_queryset.filter( - Q(is_active=True) | Q(deactivation_date__gt=interval_end), - created_date__lte=interval_end, - ) - user_stats["total"].append(interval_queryset.filter().count()) - user_stats["active"].append( - interval_queryset.filter( - last_active_date__gt=interval_end - timedelta(days=31), + user_queryset = models.User.objects.filter(local=True) + user_chart = Chart( + queryset=user_queryset, + queries={ + "total": lambda q, s, e: q.filter( + Q(is_active=True) | Q(deactivation_date__gt=e), + created_date__lte=e, + ).count(), + "active": lambda q, s, e: q.filter( + Q(is_active=True) | Q(deactivation_date__gt=e), + created_date__lte=e, + ).filter( + last_active_date__gt=e - timedelta(days=31), ).count() - ) - user_stats["labels"].append(interval_start.strftime("%b %d")) + } + ) - status_stats["total"].append( - status_queryset.filter( - created_date__gt=interval_start, - created_date__lte=interval_end, + status_queryset = models.Status.objects.filter(user__local=True, deleted=False) + status_chart = Chart( + queryset=status_queryset, + queries = { + "total": lambda q, s, e: q.filter( + created_date__gt=s, + created_date__lte=e, ).count() - ) - status_stats["labels"].append(interval_start.strftime("%b %d")) - interval_start = interval_end - interval_end += timedelta(days=interval) + } + ) data = { "start": start.strftime("%Y-%m-%d"), @@ -82,7 +77,32 @@ class Dashboard(View): "invite_requests": models.InviteRequest.objects.filter( ignored=False, invite_sent=False ).count(), - "user_stats": user_stats, - "status_stats": status_stats, + "user_stats": user_chart.get_chart(start, end, interval), + "status_stats": status_chart.get_chart(start, end, interval), } return TemplateResponse(request, "settings/dashboard/dashboard.html", data) + + +class Chart: + """ Data for a chart """ + + def __init__(self, queryset, queries: dict): + self.queryset = queryset + self.queries = queries + + def get_chart(self, start, end, interval): + """ load the data for the chart given a time scale and interval """ + interval_start = start + interval_end = interval_start + timedelta(days=interval) + + chart = {k: [] for k in self.queries.keys()} + chart["labels"] = [] + while interval_start <= end: + for (name, query) in self.queries.items(): + chart[name].append(query(self.queryset, interval_start, interval_end)) + chart["labels"].append(interval_start.strftime("%b %d")) + + interval_start = interval_end + interval_end += timedelta(days=interval) + + return chart From fa241b08e7f5502a4f988ba6d5614abd90db1e13 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 10:42:02 -0700 Subject: [PATCH 05/19] Rename charts snippets and add register chart file --- .../settings/dashboard/dashboard.html | 15 ++++++++---- .../dashboard/registration_chart.html | 24 +++++++++++++++++++ ...rd_status_chart.html => status_chart.html} | 0 ...hboard_user_chart.html => user_chart.html} | 0 bookwyrm/views/admin/dashboard.py | 11 +++++++++ 5 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 bookwyrm/templates/settings/dashboard/registration_chart.html rename bookwyrm/templates/settings/dashboard/{dashboard_status_chart.html => status_chart.html} (100%) rename bookwyrm/templates/settings/dashboard/{dashboard_user_chart.html => user_chart.html} (100%) diff --git a/bookwyrm/templates/settings/dashboard/dashboard.html b/bookwyrm/templates/settings/dashboard/dashboard.html index fbf3ff72a..863df40d9 100644 --- a/bookwyrm/templates/settings/dashboard/dashboard.html +++ b/bookwyrm/templates/settings/dashboard/dashboard.html @@ -95,9 +95,9 @@ -
+
-

{% trans "User signup activity" %}

+

{% trans "Total users" %}

@@ -108,6 +108,12 @@
+
+

{% trans "User signup activity" %}

+
+ +
+
@@ -115,6 +121,7 @@ {% block scripts %} -{% include 'settings/dashboard/dashboard_user_chart.html' %} -{% include 'settings/dashboard/dashboard_status_chart.html' %} +{% include 'settings/dashboard/user_chart.html' %} +{% include 'settings/dashboard/status_chart.html' %} +{% include 'settings/dashboard/registration_chart.html' %} {% endblock %} diff --git a/bookwyrm/templates/settings/dashboard/registration_chart.html b/bookwyrm/templates/settings/dashboard/registration_chart.html new file mode 100644 index 000000000..eec909ed3 --- /dev/null +++ b/bookwyrm/templates/settings/dashboard/registration_chart.html @@ -0,0 +1,24 @@ +{% load i18n %} + diff --git a/bookwyrm/templates/settings/dashboard/dashboard_status_chart.html b/bookwyrm/templates/settings/dashboard/status_chart.html similarity index 100% rename from bookwyrm/templates/settings/dashboard/dashboard_status_chart.html rename to bookwyrm/templates/settings/dashboard/status_chart.html diff --git a/bookwyrm/templates/settings/dashboard/dashboard_user_chart.html b/bookwyrm/templates/settings/dashboard/user_chart.html similarity index 100% rename from bookwyrm/templates/settings/dashboard/dashboard_user_chart.html rename to bookwyrm/templates/settings/dashboard/user_chart.html diff --git a/bookwyrm/views/admin/dashboard.py b/bookwyrm/views/admin/dashboard.py index 66dd9c90f..27edc3438 100644 --- a/bookwyrm/views/admin/dashboard.py +++ b/bookwyrm/views/admin/dashboard.py @@ -63,6 +63,16 @@ class Dashboard(View): } ) + register_chart = Chart( + queryset=user_queryset, + queries = { + "total": lambda q, s, e: q.filter( + created_date__gt=s, + created_date__lte=e, + ).count() + } + ) + data = { "start": start.strftime("%Y-%m-%d"), "end": end.strftime("%Y-%m-%d"), @@ -79,6 +89,7 @@ class Dashboard(View): ).count(), "user_stats": user_chart.get_chart(start, end, interval), "status_stats": status_chart.get_chart(start, end, interval), + "register_stats": register_chart.get_chart(start, end, interval), } return TemplateResponse(request, "settings/dashboard/dashboard.html", data) From 37cd7e684cb8b4f9d0ba4256043a15932b9315a7 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 10:53:22 -0700 Subject: [PATCH 06/19] Updates chart markup --- .../settings/dashboard/dashboard.html | 8 ++--- .../dashboard/registration_chart.html | 35 ++++++++----------- .../settings/dashboard/status_chart.html | 31 +++++++--------- 3 files changed, 32 insertions(+), 42 deletions(-) diff --git a/bookwyrm/templates/settings/dashboard/dashboard.html b/bookwyrm/templates/settings/dashboard/dashboard.html index 863df40d9..cd0ddc842 100644 --- a/bookwyrm/templates/settings/dashboard/dashboard.html +++ b/bookwyrm/templates/settings/dashboard/dashboard.html @@ -96,22 +96,22 @@
-
+

{% trans "Total users" %}

-
+

{% trans "Status activity" %}

-
+

{% trans "User signup activity" %}

- +
diff --git a/bookwyrm/templates/settings/dashboard/registration_chart.html b/bookwyrm/templates/settings/dashboard/registration_chart.html index eec909ed3..e98a0f18f 100644 --- a/bookwyrm/templates/settings/dashboard/registration_chart.html +++ b/bookwyrm/templates/settings/dashboard/registration_chart.html @@ -1,24 +1,19 @@ {% load i18n %} diff --git a/bookwyrm/templates/settings/dashboard/status_chart.html b/bookwyrm/templates/settings/dashboard/status_chart.html index bbacf3f46..5e1045fce 100644 --- a/bookwyrm/templates/settings/dashboard/status_chart.html +++ b/bookwyrm/templates/settings/dashboard/status_chart.html @@ -1,26 +1,21 @@ {% load i18n %} From 551b49b903cfdfe8e63de58de788b67b320aaf11 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 11:14:50 -0700 Subject: [PATCH 07/19] Adds works chart and updates colors --- .../settings/dashboard/dashboard.html | 11 ++++- .../dashboard/registration_chart.html | 4 +- .../settings/dashboard/status_chart.html | 4 +- .../settings/dashboard/user_chart.html | 40 +++++++++---------- .../settings/dashboard/works_chart.html | 21 ++++++++++ bookwyrm/views/admin/dashboard.py | 11 +++++ 6 files changed, 63 insertions(+), 28 deletions(-) create mode 100644 bookwyrm/templates/settings/dashboard/works_chart.html diff --git a/bookwyrm/templates/settings/dashboard/dashboard.html b/bookwyrm/templates/settings/dashboard/dashboard.html index cd0ddc842..445bf2992 100644 --- a/bookwyrm/templates/settings/dashboard/dashboard.html +++ b/bookwyrm/templates/settings/dashboard/dashboard.html @@ -102,6 +102,12 @@
+
+

{% trans "User signup activity" %}

+
+ +
+

{% trans "Status activity" %}

@@ -109,9 +115,9 @@
-

{% trans "User signup activity" %}

+

{% trans "Works created" %}

- +
@@ -124,4 +130,5 @@ {% include 'settings/dashboard/user_chart.html' %} {% include 'settings/dashboard/status_chart.html' %} {% include 'settings/dashboard/registration_chart.html' %} +{% include 'settings/dashboard/works_chart.html' %} {% endblock %} diff --git a/bookwyrm/templates/settings/dashboard/registration_chart.html b/bookwyrm/templates/settings/dashboard/registration_chart.html index e98a0f18f..3b258fec8 100644 --- a/bookwyrm/templates/settings/dashboard/registration_chart.html +++ b/bookwyrm/templates/settings/dashboard/registration_chart.html @@ -8,8 +8,8 @@ var registerStats = new Chart( labels: [{% for label in register_stats.labels %}"{{ label }}",{% endfor %}], datasets: [{ label: '{% trans "Registrations" %}', - backgroundColor: 'rgb(75, 192, 192)', - borderColor: 'rgb(75, 192, 192)', + backgroundColor: 'hsl(171, 100%, 41%)', + borderColor: 'hsl(171, 100%, 41%)', data: {{ register_stats.total }}, }] }, diff --git a/bookwyrm/templates/settings/dashboard/status_chart.html b/bookwyrm/templates/settings/dashboard/status_chart.html index 5e1045fce..a59036a51 100644 --- a/bookwyrm/templates/settings/dashboard/status_chart.html +++ b/bookwyrm/templates/settings/dashboard/status_chart.html @@ -9,8 +9,8 @@ var statusStats = new Chart( labels: [{% for label in status_stats.labels %}"{{ label }}",{% endfor %}], datasets: [{ label: '{% trans "Statuses posted" %}', - backgroundColor: 'rgb(255, 99, 132)', - borderColor: 'rgb(255, 99, 132)', + backgroundColor: 'hsl(141, 71%, 48%)', + borderColor: 'hsl(141, 71%, 48%)', data: {{ status_stats.total }}, }] }, diff --git a/bookwyrm/templates/settings/dashboard/user_chart.html b/bookwyrm/templates/settings/dashboard/user_chart.html index 33be28f7e..a8d356bb8 100644 --- a/bookwyrm/templates/settings/dashboard/user_chart.html +++ b/bookwyrm/templates/settings/dashboard/user_chart.html @@ -1,29 +1,25 @@ {% load i18n %} diff --git a/bookwyrm/templates/settings/dashboard/works_chart.html b/bookwyrm/templates/settings/dashboard/works_chart.html new file mode 100644 index 000000000..c65014e98 --- /dev/null +++ b/bookwyrm/templates/settings/dashboard/works_chart.html @@ -0,0 +1,21 @@ +{% load i18n %} + + diff --git a/bookwyrm/views/admin/dashboard.py b/bookwyrm/views/admin/dashboard.py index 27edc3438..b1aedecf7 100644 --- a/bookwyrm/views/admin/dashboard.py +++ b/bookwyrm/views/admin/dashboard.py @@ -73,6 +73,16 @@ class Dashboard(View): } ) + works_chart = Chart( + queryset=models.Work.objects, + queries = { + "total": lambda q, s, e: q.filter( + created_date__gt=s, + created_date__lte=e, + ).count() + } + ) + data = { "start": start.strftime("%Y-%m-%d"), "end": end.strftime("%Y-%m-%d"), @@ -90,6 +100,7 @@ class Dashboard(View): "user_stats": user_chart.get_chart(start, end, interval), "status_stats": status_chart.get_chart(start, end, interval), "register_stats": register_chart.get_chart(start, end, interval), + "works_stats": works_chart.get_chart(start, end, interval), } return TemplateResponse(request, "settings/dashboard/dashboard.html", data) From 2335945a501949c81f6a40c85216f0428a7889c3 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 11:16:02 -0700 Subject: [PATCH 08/19] Python formatting --- bookwyrm/views/admin/dashboard.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/bookwyrm/views/admin/dashboard.py b/bookwyrm/views/admin/dashboard.py index b1aedecf7..2766eeebb 100644 --- a/bookwyrm/views/admin/dashboard.py +++ b/bookwyrm/views/admin/dashboard.py @@ -46,41 +46,43 @@ class Dashboard(View): "active": lambda q, s, e: q.filter( Q(is_active=True) | Q(deactivation_date__gt=e), created_date__lte=e, - ).filter( + ) + .filter( last_active_date__gt=e - timedelta(days=31), - ).count() - } + ) + .count(), + }, ) status_queryset = models.Status.objects.filter(user__local=True, deleted=False) status_chart = Chart( queryset=status_queryset, - queries = { + queries={ "total": lambda q, s, e: q.filter( created_date__gt=s, created_date__lte=e, ).count() - } + }, ) register_chart = Chart( queryset=user_queryset, - queries = { + queries={ "total": lambda q, s, e: q.filter( created_date__gt=s, created_date__lte=e, ).count() - } + }, ) works_chart = Chart( queryset=models.Work.objects, - queries = { + queries={ "total": lambda q, s, e: q.filter( created_date__gt=s, created_date__lte=e, ).count() - } + }, ) data = { @@ -106,14 +108,14 @@ class Dashboard(View): class Chart: - """ Data for a chart """ + """Data for a chart""" def __init__(self, queryset, queries: dict): self.queryset = queryset self.queries = queries def get_chart(self, start, end, interval): - """ load the data for the chart given a time scale and interval """ + """load the data for the chart given a time scale and interval""" interval_start = start interval_end = interval_start + timedelta(days=interval) From 636eca97cb121be6a454df9f1734b748c1565040 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 4 Oct 2021 11:22:14 -0700 Subject: [PATCH 09/19] Better mobile display --- bookwyrm/templates/settings/dashboard/dashboard.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bookwyrm/templates/settings/dashboard/dashboard.html b/bookwyrm/templates/settings/dashboard/dashboard.html index 445bf2992..f320028b7 100644 --- a/bookwyrm/templates/settings/dashboard/dashboard.html +++ b/bookwyrm/templates/settings/dashboard/dashboard.html @@ -9,26 +9,26 @@ {% block panel %} -
-
+
+

{% trans "Total users" %}

{{ users|intcomma }}

-
+

{% trans "Active this month" %}

{{ active_users|intcomma }}

-
+

{% trans "Statuses" %}

{{ statuses|intcomma }}

-
+

{% trans "Works" %}

{{ works|intcomma }}

@@ -64,7 +64,7 @@

{% trans "Instance Activity" %}

-
+