From e149551e307da50168d6efd2c32964e725738507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20Porto?= Date: Wed, 2 Oct 2024 15:06:58 -0300 Subject: [PATCH] changing trimester dates; fixing email of agenda to get manager only --- agenda/views.py | 2 +- metrics/views.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/agenda/views.py b/agenda/views.py index 9e23a9d..198db89 100644 --- a/agenda/views.py +++ b/agenda/views.py @@ -177,7 +177,7 @@ def send_email(request): areas = TeamArea.objects.filter(team_area_of_position__type__name="Manager") for area in areas: - manager = UserProfile.objects.filter(user__is_active=True, position__area_associated=area).first() + manager = UserProfile.objects.filter(user__is_active=True, position__area_associated=area, position__type__name="Manager").first() manager_email = manager.user.email if manager_email: diff --git a/metrics/views.py b/metrics/views.py index ec2c0f0..8d3f2a0 100644 --- a/metrics/views.py +++ b/metrics/views.py @@ -151,9 +151,9 @@ def export_trimester_report_by_by_area_responsible(request): def get_results_divided_by_trimester(buffer, area=None): timespan_array = [ (datetime.date(datetime.datetime.today().year, 1, 1), datetime.date(datetime.datetime.today().year, 3, 31)), - (datetime.date(datetime.datetime.today().year, 4, 1), datetime.date(datetime.datetime.today().year, 6, 30)), - (datetime.date(datetime.datetime.today().year, 7, 1), datetime.date(datetime.datetime.today().year, 9, 30)), - (datetime.date(datetime.datetime.today().year, 10, 1), datetime.date(datetime.datetime.today().year, 12, 31)), + (datetime.date(datetime.datetime.today().year, 4, 1), datetime.date(datetime.datetime.today().year, 6, 18)), + (datetime.date(datetime.datetime.today().year, 6, 19), datetime.date(datetime.datetime.today().year, 9, 20)), + (datetime.date(datetime.datetime.today().year, 9, 21), datetime.date(datetime.datetime.today().year, 12, 31)), (datetime.date(datetime.datetime.today().year, 1, 1), datetime.date(datetime.datetime.today().year, 12, 31)) ] if area: @@ -188,7 +188,7 @@ def get_results_divided_by_trimester(buffer, area=None): def get_results_for_timespan(timespan_array, metric_query=Q(), report_query=Q()): results = [] - for metric in Metric.objects.filter(metric_query).order_by("activity_id"): + for metric in Metric.objects.filter(metric_query).order_by("activity_id", "id"): done_row = [] refs = [] for time_ini, time_end in timespan_array: