savoirfairelinux / sous-chef

Sous-Chef is a web application to help organizations to plan and deliver meals, and to manage clients files.
GNU Affero General Public License v3.0
67 stars 45 forks source link

Birthday dashboard should only display ACTIVE, PAUSED, PENDING clients #847

Closed JeanFrancoisFournier closed 4 years ago

JeanFrancoisFournier commented 4 years ago

Expected Behaviour

Birthday dashboard should only display ACTIVE, PAUSED, PENDING clients

Actual Behaviour

Birthday dashboard currently displays all clients regardless of their status.

Steps to reproduce

guillaumep commented 4 years ago

See ClientManager.get_birthday_boys_and_girls in src/member/models.py.

First lead (incomplete code): in HomeView.get_context_data:

diff --git a/src/page/views.py b/src/page/views.py
index ff3629b..d62d095 100644
--- a/src/page/views.py
+++ b/src/page/views.py
@@ -24,7 +24,7 @@ class HomeView(LoginRequiredMixin, PermissionRequiredMixin, TemplateView):
         today = datetime.today()
         active_clients = Client.active.all().count()
         pending_clients = Client.pending.all().count()
-        clients = Client.contact.get_birthday_boys_and_girls()
+        birthday_clients = Client.active.get_birthday_boys_and_girls()
         billable_orders = Order.objects.get_billable_orders(
             today.year, today.month
         ).count()
@@ -33,7 +33,7 @@ class HomeView(LoginRequiredMixin, PermissionRequiredMixin, TemplateView):
             delivery_date__year=datetime.today().year).count()
         context['active_clients'] = active_clients
         context['pending_clients'] = pending_clients
-        context['birthday'] = clients
+        context['birthday'] = birthday_clients
         context['billable_orders_month'] = billable_orders
         context['billable_orders_year'] = billable_orders_year
         context['routes'] = self.calculate_route_table()
guillaumep commented 4 years ago

Confirmed working in staging environment.

JeanFrancoisFournier commented 3 years ago

Tested and confirmed