@@ -2,7 +2,7 @@ import logging from datetime import date, datetime, timedelta from django.core.exceptions import ObjectDoesNotExist -from django.db.models import F, Sum, functions +from django.db.models import F, Sum, functions, Func from django.db.models.query import QuerySet from django.db.transaction import atomic from django.utils import timezone @@ -268,8 +268,8 @@ class ExpensesAPIView(APIView): ) match request.query_params.get('source_strategy'): case 'categories': - qs = qs.values('model__category__title').annotate( - source=F('model__category__title'), + qs = qs.values('model__types').annotate( + source=Func(F('model__types'), function='unnest'), amount=functions.Round(Sum('cost')), ) case 'models': @@ -104,6 +104,7 @@ services: - | python manage.py collectstatic --no-input python manage.py migrate + python manage.py initialize_buckets ([ '$DEBUG' = 'true' ] && python manage.py createsuperuser --no-input) || true env_file: - $ENV @@ -129,6 +130,11 @@ services: - $ENV environment: - C_FORCE_ROOT=true + develop: + watch: + - path: ./ + action: sync+restart + target: /app celery_beat: <<: *app-build @@ -149,6 +155,11 @@ services: - node.role == worker env_file: - $ENV + develop: + watch: + - path: ./ + action: sync+restart + target: /app static-server: image: nginx:alpine