From 7a79c66f09cc161b3930edfb3be84efeb6f3e1ec Mon Sep 17 00:00:00 2001 From: Xavier Fiechter Date: Wed, 9 Oct 2024 14:03:00 +0200 Subject: [PATCH] version bump 2.2.3, minor fixes --- django/finances/models.py | 4 ++-- django/finances/signals.py | 22 ++++++++++++++----- django/labellabor/settings.py | 6 ++++- django/templates/_dropdown_profile.html | 2 +- django/templates/registration/logged_out.html | 2 +- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/django/finances/models.py b/django/finances/models.py index 96b41a0..b9a2201 100644 --- a/django/finances/models.py +++ b/django/finances/models.py @@ -278,8 +278,8 @@ class HistoricalPrice(models.Model): class Meta: ordering = ['-timestamp'] - @classmethod - def get_or_create_from_api(user, cls, timestamp=-1): + @classmethod + def get_or_create_from_api(cls, user=None, timestamp=-1): if timestamp == -1: current_datetime = datetime.datetime.now() timestamp = int(current_datetime.timestamp()) diff --git a/django/finances/signals.py b/django/finances/signals.py index 5409b25..df9078e 100644 --- a/django/finances/signals.py +++ b/django/finances/signals.py @@ -5,11 +5,21 @@ from finances.models import HistoricalPrice @receiver(user_logged_in) def perform_tasks_on_login(sender, user, request, **kwargs): - if user.profile.update_utxo_on_login: - from finances.tasks import check_all_outputs - from labelbase.models import Label - check_all_outputs(user.id) - if Label.objects.filter(labelbase__user_id=user.id).exists(): - messages.info(request, "Sync in progress: We are checking your unspent transaction outputs now.") + try: + if user.profile.update_utxo_on_login: + from finances.tasks import check_all_outputs + from labelbase.models import Label + check_all_outputs(user.id) + if Label.objects.filter(labelbase__user_id=user.id).exists(): + messages.info(request, ( + "Sync in progress: " + "We are checking your unspent transaction outputs now." + )) + except Exception as ex: + messages.info(request, ( + "Oups: " + f"{ex}" + )) + # Store nearest price information. HistoricalPrice.get_or_create_from_api(user, -1) diff --git a/django/labellabor/settings.py b/django/labellabor/settings.py index c37e778..4104b77 100644 --- a/django/labellabor/settings.py +++ b/django/labellabor/settings.py @@ -54,7 +54,7 @@ sentry_sdk.init( traces_sample_rate=1.0, send_default_pii=True, # must be "True" here, will skip or omit in `before_send` callback ) -sentry_sdk.set_tag("version", "2.2.2") +sentry_sdk.set_tag("version", "2.2.3") LOGGING = { @@ -103,8 +103,11 @@ INSTALLED_APPS = [ "django_otp", "django_otp.plugins.otp_static", "django_otp.plugins.otp_totp", + "labelbase", "userprofile", + "notifications", + "bootstrapform", "cryptography", "rest_framework", @@ -119,6 +122,7 @@ INSTALLED_APPS = [ "statusapp", "attachments", "messages_extends", + ] diff --git a/django/templates/_dropdown_profile.html b/django/templates/_dropdown_profile.html index 50018ee..44ba355 100644 --- a/django/templates/_dropdown_profile.html +++ b/django/templates/_dropdown_profile.html @@ -59,7 +59,7 @@
- Privacy PolicyTermsv2.2.2 + Privacy PolicyTermsv2.2.3
diff --git a/django/templates/registration/logged_out.html b/django/templates/registration/logged_out.html index 49d12b8..a512367 100644 --- a/django/templates/registration/logged_out.html +++ b/django/templates/registration/logged_out.html @@ -2,6 +2,6 @@ {% load i18n %} {% block content %} -

{% block title %}{% trans "Logged Out" %}{% endblock %}

+

{% block title %}{% trans "Logged Out" %}{% endblock %}

{% trans "See you around!" %}

{% endblock %}