diff --git a/tomato/tests/tests_viewset_Tomato.py b/tomato/tests/tests_viewset_Tomato.py index da4b4f13..3cd6881f 100644 --- a/tomato/tests/tests_viewset_Tomato.py +++ b/tomato/tests/tests_viewset_Tomato.py @@ -574,19 +574,19 @@ def test_statistics_tomatoes_empty_data(self): self.assertEqual( result['graph']['labels'], [ - '2022-02-01T00:00:00-0500', - '2022-03-01T00:00:00-0500', - '2022-04-01T00:00:00-0500', - '2022-05-01T00:00:00-0500', - '2022-06-01T00:00:00-0500', - '2022-07-01T00:00:00-0500', - '2022-08-01T00:00:00-0500', - '2022-09-01T00:00:00-0500', - '2022-10-01T00:00:00-0500', - '2022-11-01T00:00:00-0500', - '2022-12-01T00:00:00-0500', - '2023-01-01T00:00:00-0500', - '2023-02-01T00:00:00-0500', + '2022-02-01T00:00:00', + '2022-03-01T00:00:00', + '2022-04-01T00:00:00', + '2022-05-01T00:00:00', + '2022-06-01T00:00:00', + '2022-07-01T00:00:00', + '2022-08-01T00:00:00', + '2022-09-01T00:00:00', + '2022-10-01T00:00:00', + '2022-11-01T00:00:00', + '2022-12-01T00:00:00', + '2023-01-01T00:00:00', + '2023-02-01T00:00:00', ], ) self.assertEqual( @@ -595,19 +595,19 @@ def test_statistics_tomatoes_empty_data(self): { 'label': 'number_of_tomato', 'data': [ - {'x': '2022-02-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-03-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-04-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-05-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-06-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-07-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-08-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-09-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-10-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-11-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-12-01T00:00:00-0500', 'y': 0.0}, - {'x': '2023-01-01T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-01T00:00:00-0500', 'y': 0.0}, + {'x': '2022-02-01T00:00:00', 'y': 0.0}, + {'x': '2022-03-01T00:00:00', 'y': 0.0}, + {'x': '2022-04-01T00:00:00', 'y': 0.0}, + {'x': '2022-05-01T00:00:00', 'y': 0.0}, + {'x': '2022-06-01T00:00:00', 'y': 0.0}, + {'x': '2022-07-01T00:00:00', 'y': 0.0}, + {'x': '2022-08-01T00:00:00', 'y': 0.0}, + {'x': '2022-09-01T00:00:00', 'y': 0.0}, + {'x': '2022-10-01T00:00:00', 'y': 0.0}, + {'x': '2022-11-01T00:00:00', 'y': 0.0}, + {'x': '2022-12-01T00:00:00', 'y': 0.0}, + {'x': '2023-01-01T00:00:00', 'y': 0.0}, + {'x': '2023-02-01T00:00:00', 'y': 0.0}, ] } ], @@ -675,19 +675,19 @@ def test_statistics_tomatoes_year(self): self.assertEqual( result['graph']['labels'], [ - '2022-02-01T00:00:00-0500', - '2022-03-01T00:00:00-0500', - '2022-04-01T00:00:00-0500', - '2022-05-01T00:00:00-0500', - '2022-06-01T00:00:00-0500', - '2022-07-01T00:00:00-0500', - '2022-08-01T00:00:00-0500', - '2022-09-01T00:00:00-0500', - '2022-10-01T00:00:00-0500', - '2022-11-01T00:00:00-0500', - '2022-12-01T00:00:00-0500', - '2023-01-01T00:00:00-0500', - '2023-02-01T00:00:00-0500', + '2022-02-01T00:00:00', + '2022-03-01T00:00:00', + '2022-04-01T00:00:00', + '2022-05-01T00:00:00', + '2022-06-01T00:00:00', + '2022-07-01T00:00:00', + '2022-08-01T00:00:00', + '2022-09-01T00:00:00', + '2022-10-01T00:00:00', + '2022-11-01T00:00:00', + '2022-12-01T00:00:00', + '2023-01-01T00:00:00', + '2023-02-01T00:00:00', ], ) self.assertEqual( @@ -696,20 +696,20 @@ def test_statistics_tomatoes_year(self): { 'label': 'number_of_tomato', 'data': [ - {'x': '2022-02-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-03-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-04-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-05-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-06-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-07-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-08-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-09-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-10-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-11-01T00:00:00-0500', 'y': 0.0}, - {'x': '2022-12-01T00:00:00-0500', 'y': 0.0}, - {'x': '2023-01-01T00:00:00-0500', 'y': 0.0}, + {'x': '2022-02-01T00:00:00', 'y': 0.0}, + {'x': '2022-03-01T00:00:00', 'y': 0.0}, + {'x': '2022-04-01T00:00:00', 'y': 0.0}, + {'x': '2022-05-01T00:00:00', 'y': 0.0}, + {'x': '2022-06-01T00:00:00', 'y': 0.0}, + {'x': '2022-07-01T00:00:00', 'y': 0.0}, + {'x': '2022-08-01T00:00:00', 'y': 0.0}, + {'x': '2022-09-01T00:00:00', 'y': 0.0}, + {'x': '2022-10-01T00:00:00', 'y': 0.0}, + {'x': '2022-11-01T00:00:00', 'y': 0.0}, + {'x': '2022-12-01T00:00:00', 'y': 0.0}, + {'x': '2023-01-01T00:00:00', 'y': 0.0}, { - 'x': '2023-02-01T00:00:00-0500', + 'x': '2023-02-01T00:00:00', 'y': 60.0 }, ] @@ -779,38 +779,38 @@ def test_statistics_tomatoes_month(self): self.assertEqual( result['graph']['labels'], [ - '2023-01-25T00:00:00-0500', - '2023-01-26T00:00:00-0500', - '2023-01-27T00:00:00-0500', - '2023-01-28T00:00:00-0500', - '2023-01-29T00:00:00-0500', - '2023-01-30T00:00:00-0500', - '2023-01-31T00:00:00-0500', - '2023-02-01T00:00:00-0500', - '2023-02-02T00:00:00-0500', - '2023-02-03T00:00:00-0500', - '2023-02-04T00:00:00-0500', - '2023-02-05T00:00:00-0500', - '2023-02-06T00:00:00-0500', - '2023-02-07T00:00:00-0500', - '2023-02-08T00:00:00-0500', - '2023-02-09T00:00:00-0500', - '2023-02-10T00:00:00-0500', - '2023-02-11T00:00:00-0500', - '2023-02-12T00:00:00-0500', - '2023-02-13T00:00:00-0500', - '2023-02-14T00:00:00-0500', - '2023-02-15T00:00:00-0500', - '2023-02-16T00:00:00-0500', - '2023-02-17T00:00:00-0500', - '2023-02-18T00:00:00-0500', - '2023-02-19T00:00:00-0500', - '2023-02-20T00:00:00-0500', - '2023-02-21T00:00:00-0500', - '2023-02-22T00:00:00-0500', - '2023-02-23T00:00:00-0500', - '2023-02-24T00:00:00-0500', - '2023-02-25T00:00:00-0500', + '2023-01-25T00:00:00', + '2023-01-26T00:00:00', + '2023-01-27T00:00:00', + '2023-01-28T00:00:00', + '2023-01-29T00:00:00', + '2023-01-30T00:00:00', + '2023-01-31T00:00:00', + '2023-02-01T00:00:00', + '2023-02-02T00:00:00', + '2023-02-03T00:00:00', + '2023-02-04T00:00:00', + '2023-02-05T00:00:00', + '2023-02-06T00:00:00', + '2023-02-07T00:00:00', + '2023-02-08T00:00:00', + '2023-02-09T00:00:00', + '2023-02-10T00:00:00', + '2023-02-11T00:00:00', + '2023-02-12T00:00:00', + '2023-02-13T00:00:00', + '2023-02-14T00:00:00', + '2023-02-15T00:00:00', + '2023-02-16T00:00:00', + '2023-02-17T00:00:00', + '2023-02-18T00:00:00', + '2023-02-19T00:00:00', + '2023-02-20T00:00:00', + '2023-02-21T00:00:00', + '2023-02-22T00:00:00', + '2023-02-23T00:00:00', + '2023-02-24T00:00:00', + '2023-02-25T00:00:00', ], ) self.assertEqual( @@ -819,42 +819,42 @@ def test_statistics_tomatoes_month(self): { 'label': 'number_of_tomato', 'data': [ - {'x': '2023-01-25T00:00:00-0500', 'y': 0.0}, - {'x': '2023-01-26T00:00:00-0500', 'y': 0.0}, - {'x': '2023-01-27T00:00:00-0500', 'y': 0.0}, - {'x': '2023-01-28T00:00:00-0500', 'y': 0.0}, - {'x': '2023-01-29T00:00:00-0500', 'y': 0.0}, - {'x': '2023-01-30T00:00:00-0500', 'y': 0.0}, - {'x': '2023-01-31T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-01T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-02T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-03T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-04T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-05T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-06T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-07T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-08T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-09T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-10T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-11T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-12T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-13T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-14T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-15T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-16T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-17T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-18T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-19T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-20T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-21T00:00:00-0500', 'y': 0.0}, - {'x': '2023-02-22T00:00:00-0500', 'y': 0.0}, + {'x': '2023-01-25T00:00:00', 'y': 0.0}, + {'x': '2023-01-26T00:00:00', 'y': 0.0}, + {'x': '2023-01-27T00:00:00', 'y': 0.0}, + {'x': '2023-01-28T00:00:00', 'y': 0.0}, + {'x': '2023-01-29T00:00:00', 'y': 0.0}, + {'x': '2023-01-30T00:00:00', 'y': 0.0}, + {'x': '2023-01-31T00:00:00', 'y': 0.0}, + {'x': '2023-02-01T00:00:00', 'y': 0.0}, + {'x': '2023-02-02T00:00:00', 'y': 0.0}, + {'x': '2023-02-03T00:00:00', 'y': 0.0}, + {'x': '2023-02-04T00:00:00', 'y': 0.0}, + {'x': '2023-02-05T00:00:00', 'y': 0.0}, + {'x': '2023-02-06T00:00:00', 'y': 0.0}, + {'x': '2023-02-07T00:00:00', 'y': 0.0}, + {'x': '2023-02-08T00:00:00', 'y': 0.0}, + {'x': '2023-02-09T00:00:00', 'y': 0.0}, + {'x': '2023-02-10T00:00:00', 'y': 0.0}, + {'x': '2023-02-11T00:00:00', 'y': 0.0}, + {'x': '2023-02-12T00:00:00', 'y': 0.0}, + {'x': '2023-02-13T00:00:00', 'y': 0.0}, + {'x': '2023-02-14T00:00:00', 'y': 0.0}, + {'x': '2023-02-15T00:00:00', 'y': 0.0}, + {'x': '2023-02-16T00:00:00', 'y': 0.0}, + {'x': '2023-02-17T00:00:00', 'y': 0.0}, + {'x': '2023-02-18T00:00:00', 'y': 0.0}, + {'x': '2023-02-19T00:00:00', 'y': 0.0}, + {'x': '2023-02-20T00:00:00', 'y': 0.0}, + {'x': '2023-02-21T00:00:00', 'y': 0.0}, + {'x': '2023-02-22T00:00:00', 'y': 0.0}, { - 'x': '2023-02-23T00:00:00-0500', + 'x': '2023-02-23T00:00:00', 'y': 45.0 }, - {'x': '2023-02-24T00:00:00-0500', 'y': 0.0}, + {'x': '2023-02-24T00:00:00', 'y': 0.0}, { - 'x': '2023-02-25T00:00:00-0500', + 'x': '2023-02-25T00:00:00', 'y': 15.0 } ] @@ -924,13 +924,13 @@ def test_statistics_tomatoes_week(self): self.assertEqual( result['graph']['labels'], [ - '2023-02-19T00:00:00-0500', - '2023-02-20T00:00:00-0500', - '2023-02-21T00:00:00-0500', - '2023-02-22T00:00:00-0500', - '2023-02-23T00:00:00-0500', - '2023-02-24T00:00:00-0500', - '2023-02-25T00:00:00-0500', + '2023-02-19T00:00:00', + '2023-02-20T00:00:00', + '2023-02-21T00:00:00', + '2023-02-22T00:00:00', + '2023-02-23T00:00:00', + '2023-02-24T00:00:00', + '2023-02-25T00:00:00', ], ) self.assertEqual( @@ -940,31 +940,31 @@ def test_statistics_tomatoes_week(self): 'label': 'number_of_tomato', 'data': [ { - 'x': '2023-02-19T00:00:00-0500', + 'x': '2023-02-19T00:00:00', 'y': 0.0, }, { - 'x': '2023-02-20T00:00:00-0500', + 'x': '2023-02-20T00:00:00', 'y': 0.0, }, { - 'x': '2023-02-21T00:00:00-0500', + 'x': '2023-02-21T00:00:00', 'y': 0.0, }, { - 'x': '2023-02-22T00:00:00-0500', + 'x': '2023-02-22T00:00:00', 'y': 0.0, }, { - 'x': '2023-02-23T00:00:00-0500', + 'x': '2023-02-23T00:00:00', 'y': 45.0 }, { - 'x': '2023-02-24T00:00:00-0500', + 'x': '2023-02-24T00:00:00', 'y': 0.0 }, { - 'x': '2023-02-25T00:00:00-0500', + 'x': '2023-02-25T00:00:00', 'y': 15.0 } ] diff --git a/tomato/views.py b/tomato/views.py index 3b2d218f..cdf7b7d0 100644 --- a/tomato/views.py +++ b/tomato/views.py @@ -395,7 +395,7 @@ def _get_intervals(start, end, interval_param): if interval_param == 'day': while end >= date: labels.add( - date.strftime("%Y-%m-%dT%H:%M:%S%z") + date.strftime("%Y-%m-%dT%H:%M:%S") ) date += timedelta(days=1) else: @@ -403,7 +403,7 @@ def _get_intervals(start, end, interval_param): end = end.replace(day=1, hour=0, minute=0, second=0) while end >= date: labels.add( - date.strftime("%Y-%m-%dT%H:%M:%S%z") + date.strftime("%Y-%m-%dT%H:%M:%S") ) # Get first day of next month date += timedelta(days=32) @@ -439,7 +439,7 @@ def _get_data(queryset, data_set_type, labels): non_covered_labels = labels.copy() for data in queryset: - label = data['interval'].strftime('%Y-%m-%dT%H:%M:%S%z') + label = data['interval'].strftime('%Y-%m-%dT%H:%M:%S') results.append( { 'x': label,