From 96b81c55ef1fc1426c209164c910a090c052f32b Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Thu, 11 Aug 2022 16:58:09 +0200 Subject: [PATCH] [UPD]Change scale month --- models/acc_operation.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/models/acc_operation.py b/models/acc_operation.py index e8ee8bf..07971ca 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -211,11 +211,11 @@ class AccOperation(models.Model): step = "hour" if not scale: scale = "day" - elif delta < 31 and scale != "month": + elif delta < 32: step_display_courbe = "day" step = "hour" - if not scale: - scale = "week" + # if not scale: + scale = "week" elif delta <= 365: step = "month" step_display_courbe = "month" @@ -1293,6 +1293,7 @@ class AccOperation(models.Model): """ result_graph = {} + scale_init = scale if not date_start and not date_end: date_start, date_end = self.get_last_day(scale) else: @@ -1329,7 +1330,7 @@ class AccOperation(models.Model): "date_end": date_end, "date_min": date_min, "date_max": date_max, - "scale": scale, + "scale": scale_init, } ) return result_graph @@ -1355,6 +1356,7 @@ class AccOperation(models.Model): :return: dictionnaire pour la construction des graphes """ result_graph = {} + scale_init = scale if not date_start and not date_end: date_start, date_end = self.get_last_day(scale) is_scale = True @@ -1424,7 +1426,7 @@ class AccOperation(models.Model): date_min = date_min.strftime("%d/%m/%Y") if not is_scale: - scale = False + scale_init = False result_graph.update( { @@ -1432,7 +1434,7 @@ class AccOperation(models.Model): "date_end": date_end, "date_min": date_min, "date_max": date_max, - "scale": scale, + "scale": scale_init, "is_curve_line": is_curve_line, } ) -- GitLab