Merge remote-tracking branch 'upstream/develop' into develop

pull/32/head
Caozhenhui 2021-04-12 21:42:57 +08:00
commit 502862d79e
1 changed files with 12 additions and 0 deletions

View File

@ -387,6 +387,12 @@ def get_energy_category_peak_types(cost_center_id, energy_category_id, start_dat
########################################################################################################################
def averaging_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetime_utc, period_type):
# todo: validate parameters
if start_datetime_utc is None or \
end_datetime_utc is None or \
start_datetime_utc >= end_datetime_utc or \
period_type not in ('hourly', 'daily', 'monthly', 'yearly'):
return list(), None, None
start_datetime_utc = start_datetime_utc.replace(tzinfo=None)
end_datetime_utc = end_datetime_utc.replace(tzinfo=None)
@ -630,6 +636,12 @@ def averaging_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetim
########################################################################################################################
def statistics_hourly_data_by_period(rows_hourly, start_datetime_utc, end_datetime_utc, period_type):
# todo: validate parameters
if start_datetime_utc is None or \
end_datetime_utc is None or \
start_datetime_utc >= end_datetime_utc or \
period_type not in ('hourly', 'daily', 'monthly', 'yearly'):
return list(), None, None, None, None, None, None
start_datetime_utc = start_datetime_utc.replace(tzinfo=None)
end_datetime_utc = end_datetime_utc.replace(tzinfo=None)