From bffef535ea8e36900b697d320f8338044ba4b011 Mon Sep 17 00:00:00 2001 From: Caozhenhui <823914102@qq.com> Date: Thu, 4 Nov 2021 19:50:44 +0800 Subject: [PATCH] Modified the current_datetime_utcvariable in the statistics_hourly_data_by_period method --- myems-api/core/utilities.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/myems-api/core/utilities.py b/myems-api/core/utilities.py index 5930d544..5a0a1d6f 100644 --- a/myems-api/core/utilities.py +++ b/myems-api/core/utilities.py @@ -765,9 +765,7 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti variance = None # calculate the start datetime in utc of the first day in local start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) - weekday = start_datetime_local.weekday() - current_datetime_utc = \ - start_datetime_local.replace(hour=0) - timedelta(days=weekday, hours=int(config.utc_offset[1:3])) + current_datetime_utc = start_datetime_local.replace(hour=0) - timedelta(hours=int(config.utc_offset[1:3])) while current_datetime_utc <= end_datetime_utc: sub_total = Decimal(0.0) for row in rows_hourly: @@ -811,7 +809,9 @@ def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_dateti variance = None # calculate the start datetime in utc of the monday in the first week in local start_datetime_local = start_datetime_utc + timedelta(hours=int(config.utc_offset[1:3])) - current_datetime_utc = start_datetime_local.replace(hour=0) - timedelta(hours=int(config.utc_offset[1:3])) + weekday = start_datetime_local.weekday() + current_datetime_utc = \ + start_datetime_local.replace(hour=0) - timedelta(days=weekday, hours=int(config.utc_offset[1:3])) while current_datetime_utc <= end_datetime_utc: sub_total = Decimal(0.0) for row in rows_hourly: