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

pull/1/head
hyh123a 2021-02-27 23:09:09 +08:00
commit 84b6fee32a
9 changed files with 157 additions and 82 deletions

View File

@ -11,7 +11,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- None. - None.
### Fixed ### Fixed
- None. - fixed typo in combinedequipment controller in admin.
- removed required property from equipment model in admin.
- fixed energy item undefined issue when edit virtual meter and offline meter.
### Removed ### Removed
- None. - None.
@ -27,7 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- merged myems-api. - merged myems-api.
### Changed ### Changed
- None. - modified database table tbl_energy_flow_diagrams_links
### Fixed ### Fixed
- fixed energy category names and units issue in EnergyItem reports. - fixed energy category names and units issue in EnergyItem reports.

View File

@ -133,7 +133,7 @@ app.controller('OfflineMeterController', function($scope, $common, $translate, $
modalInstance.result.then(function(modifiedOfflineMeter) { modalInstance.result.then(function(modifiedOfflineMeter) {
modifiedOfflineMeter.energy_category_id = modifiedOfflineMeter.energy_category.id; modifiedOfflineMeter.energy_category_id = modifiedOfflineMeter.energy_category.id;
if(angular.isDefined(modifiedOfflineMeter.energy_item)) { if (modifiedOfflineMeter.energy_item != null && modifiedOfflineMeter.energy_item.id != null ) {
modifiedOfflineMeter.energy_item_id = modifiedOfflineMeter.energy_item.id; modifiedOfflineMeter.energy_item_id = modifiedOfflineMeter.energy_item.id;
} else { } else {
modifiedOfflineMeter.energy_item_id = undefined; modifiedOfflineMeter.energy_item_id = undefined;

View File

@ -159,7 +159,7 @@ $scope.getAllEnergyItems = function() {
modalInstance.result.then(function(modifiedVirtualMeter) { modalInstance.result.then(function(modifiedVirtualMeter) {
modifiedVirtualMeter.energy_category_id = modifiedVirtualMeter.energy_category.id; modifiedVirtualMeter.energy_category_id = modifiedVirtualMeter.energy_category.id;
if(angular.isDefined(modifiedVirtualMeter.energy_item)) { if (modifiedVirtualMeter.energy_item != null && modifiedVirtualMeter.energy_item.id != null ) {
modifiedVirtualMeter.energy_item_id = modifiedVirtualMeter.energy_item.id; modifiedVirtualMeter.energy_item_id = modifiedVirtualMeter.energy_item.id;
} else { } else {
modifiedVirtualMeter.energy_item_id = undefined; modifiedVirtualMeter.energy_item_id = undefined;

View File

@ -482,7 +482,8 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_energy_flow_diagrams_links` (
`energy_flow_diagram_id` BIGINT NOT NULL, `energy_flow_diagram_id` BIGINT NOT NULL,
`source_node_id` BIGINT NOT NULL, `source_node_id` BIGINT NOT NULL,
`target_node_id` BIGINT NOT NULL, `target_node_id` BIGINT NOT NULL,
`meter_uuid` CHAR(36) NOT NULL, `value_object_type` VARCHAR(32) NOT NULL COMMENT 'meter, offline_meter, virtual_meter, space',
`value_object_id` BIGINT NOT NULL,
PRIMARY KEY (`id`)); PRIMARY KEY (`id`));
CREATE INDEX `tbl_energy_flow_diagrams_links_index_1` ON `myems_system_db`.`tbl_energy_flow_diagrams_links` (`energy_flow_diagram_id`); CREATE INDEX `tbl_energy_flow_diagrams_links_index_1` ON `myems_system_db`.`tbl_energy_flow_diagrams_links` (`energy_flow_diagram_id`);
@ -493,16 +494,15 @@ CREATE INDEX `tbl_energy_flow_diagrams_links_index_1` ON `myems_system_db`.`tbl
-- USE `myems_system_db`; -- USE `myems_system_db`;
-- --
-- INSERT INTO `myems_system_db`.`tbl_energy_flow_diagrams_links` -- INSERT INTO `myems_system_db`.`tbl_energy_flow_diagrams_links`
-- (`id`, `energy_flow_diagram_id`, `name`) -- (`id`, `energy_flow_diagram_id`, `source_node_id`, `value_object_type`, `object_uuid`)
-- VALUES -- VALUES
-- (1, 1, 1, 3, '5ca47bc5-22c2-47fc-b906-33222191ea40'), -- (1, 1, 1, 3, 'space', 1),
-- (2, 1, 2, 4, '5d4d2f06-6200-4671-b182-4cf32cd9228f'), -- (2, 1, 2, 4, 'space', 2),
-- (3, 1, 2, 5, '7897665b-66ac-481d-9c31-2ab2ecbda16c'), -- (3, 1, 2, 5, 'space', 3),
-- (4, 1, 2, 6, 'f0c278ec-eb32-4c5e-a35f-88643b00c367'), -- (4, 1, 2, 6, 'space', 4),
-- (5, 1, 3, 7, '9918aa6c-79e9-4579-8f2e-a76eb9fe4e3e'), -- (5, 1, 3, 7, 'meter', 1),
-- (6, 1, 3, 8, '831cbc8c-1429-4840-946e-f0b389b2253e'), -- (6, 1, 3, 8, 'offline_meter', 1),
-- (7, 1, 4, 9, 'd2fc8464-3f13-42a9-8a57-63f95f677f0f'), -- (7, 1, 4, 9, 'virtual_meter', 1);
-- (8, 1, 4, 10, '7e4b3831-887b-40e2-b7f8-4d77c6f206a9');
-- --
-- COMMIT; -- COMMIT;

16
database/upgrade1.0.6.sql Normal file
View File

@ -0,0 +1,16 @@
-- NOTE: this upgrade script will drop existing data table
DROP TABLE IF EXISTS `myems_system_db`.`tbl_energy_flow_diagrams_links` ;
CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_energy_flow_diagrams_links` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`energy_flow_diagram_id` BIGINT NOT NULL,
`source_node_id` BIGINT NOT NULL,
`target_node_id` BIGINT NOT NULL,
`value_object_type` VARCHAR(32) NOT NULL COMMENT 'meter, offline_meter, virtual_meter, space',
`value_object_id` BIGINT NOT NULL,
PRIMARY KEY (`id`));
CREATE INDEX `tbl_energy_flow_diagrams_links_index_1` ON `myems_system_db`.`tbl_energy_flow_diagrams_links` (`energy_flow_diagram_id`);
-- UPDATE VERSION NUMBER
UPDATE myems_system_db.tbl_versions SET version='1.0.6', release_date='2021-02-27' WHERE id=1;

View File

@ -351,8 +351,13 @@ def generate_excel(report,
current_row_number = 19 current_row_number = 19
has_child_flag = True has_child_flag = True
if "child_space" not in report.keys() or "energy_category_names" not in report['child_space'].keys() or \ if "child_space" not in report.keys() or "energy_category_names" not in report['child_space'].keys() or \
len(report['child_space']["energy_category_names"]) == 0: len(report['child_space']["energy_category_names"]) == 0 \
or 'child_space_names_array' not in report['child_space'].keys() \
or report['child_space']['energy_category_names'] is None \
or len(report['child_space']['child_space_names_array']) == 0 \
or len(report['child_space']['child_space_names_array'][0]) == 0:
has_child_flag = False has_child_flag = False
if has_child_flag: if has_child_flag:
@ -362,6 +367,7 @@ def generate_excel(report,
ws['B' + str(current_row_number)] = name + ' 子空间数据' ws['B' + str(current_row_number)] = name + ' 子空间数据'
current_row_number += 1 current_row_number += 1
table_start_row_number = current_row_number
ws.row_dimensions[current_row_number].height = 60 ws.row_dimensions[current_row_number].height = 60
ws['B' + str(current_row_number)].fill = table_fill ws['B' + str(current_row_number)].fill = table_fill
@ -413,20 +419,21 @@ def generate_excel(report,
ws[col + row] = round(every_day_sum, 2) ws[col + row] = round(every_day_sum, 2)
ws[col + row].border = f_border ws[col + row].border = f_border
table_end_row_number = current_row_number
current_row_number += 1 current_row_number += 1
chart_start_row_number = current_row_number
# Pie # Pie
for i in range(0, ca_len): for i in range(0, ca_len):
pie = PieChart() pie = PieChart()
labels = Reference(ws, min_col=2, min_row=current_row_number - space_len, max_row=current_row_number - 1) labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1, max_row=table_end_row_number)
pie_data = Reference(ws, min_col=3 + i, min_row=current_row_number - space_len - 1, pie_data = Reference(ws, min_col=3 + i, min_row=table_start_row_number,
max_row=current_row_number - 1) max_row=table_end_row_number)
pie.add_data(pie_data, titles_from_data=True) pie.add_data(pie_data, titles_from_data=True)
pie.set_categories(labels) pie.set_categories(labels)
pie.height = 6.6 pie.height = 6.6
pie.width = 8 pie.width = 8
col = chr(ord('C') + i) pie.title = ws.cell(column=3+i, row=table_start_row_number).value
pie.title = ws[col + '20'].value
s1 = pie.series[0] s1 = pie.series[0]
s1.dLbls = DataLabelList() s1.dLbls = DataLabelList()
s1.dLbls.showCatName = False s1.dLbls.showCatName = False
@ -434,15 +441,17 @@ def generate_excel(report,
s1.dLbls.showPercent = True s1.dLbls.showPercent = True
chart_cell = '' chart_cell = ''
if i % 2 == 0: if i % 2 == 0:
chart_cell = 'B' + str(current_row_number) chart_cell = 'B' + str(chart_start_row_number)
else: else:
chart_cell = 'E' + str(current_row_number) chart_cell = 'E' + str(chart_start_row_number)
current_row_number += 5 chart_start_row_number += 5
ws.add_chart(pie, chart_cell) ws.add_chart(pie, chart_cell)
# chart_col = chr(ord('B') + 2 * i) # chart_col = chr(ord('B') + 2 * i)
# chart_cell = chart_col + str(current_row_number) # chart_cell = chart_col + str(current_row_number)
# ws.add_chart(pie, chart_cell) # ws.add_chart(pie, chart_cell)
current_row_number = chart_start_row_number
if ca_len % 2 == 1: if ca_len % 2 == 1:
current_row_number += 5 current_row_number += 5

View File

@ -395,9 +395,16 @@ def generate_excel(report,
has_child_flag = True has_child_flag = True
# Judge if the space has child space, if not, delete it. # Judge if the space has child space, if not, delete it.
if "child_space" not in report.keys() or "energy_category_names" not in report['child_space'].keys() or \ if "child_space" not in report.keys() or "energy_category_names" not in report['child_space'].keys() or \
len(report['child_space']["energy_category_names"]) == 0: len(report['child_space']["energy_category_names"]) == 0 \
or 'child_space_names_array' not in report['child_space'].keys() \
or report['child_space']['energy_category_names'] is None \
or len(report['child_space']['child_space_names_array']) == 0 \
or len(report['child_space']['child_space_names_array'][0]) == 0:
has_child_flag = False has_child_flag = False
current_row_number = 19
if has_child_flag: if has_child_flag:
child = report['child_space'] child = report['child_space']
child_spaces = child['child_space_names_array'][0] child_spaces = child['child_space_names_array'][0]
@ -411,6 +418,8 @@ def generate_excel(report,
ws['B20'].border = f_border ws['B20'].border = f_border
ca_len = len(child['energy_category_names']) ca_len = len(child['energy_category_names'])
table_start_row_number = 20
for i in range(0, ca_len): for i in range(0, ca_len):
row = chr(ord('C') + i) row = chr(ord('C') + i)
ws[row + '20'].fill = table_fill ws[row + '20'].fill = table_fill
@ -420,6 +429,7 @@ def generate_excel(report,
ws[row + '20'] = child['energy_category_names'][i] + ' (' + child['units'][i] + ')' ws[row + '20'] = child['energy_category_names'][i] + ' (' + child['units'][i] + ')'
space_len = len(child['child_space_names_array'][0]) space_len = len(child['child_space_names_array'][0])
for i in range(0, space_len): for i in range(0, space_len):
row = str(i + 21) row = str(i + 21)
@ -434,58 +444,74 @@ def generate_excel(report,
ws[col + row].alignment = c_c_alignment ws[col + row].alignment = c_c_alignment
ws[col + row] = round(child['subtotals_array'][j][i], 2) ws[col + row] = round(child['subtotals_array'][j][i], 2)
ws[col + row].border = f_border ws[col + row].border = f_border
# pie
# 25~30: pie table_end_row_number = 20 + space_len
pie = PieChart() chart_start_row_number = 20 + space_len + 1
pie.title = ws.cell(column=3 + j, row=20).value
labels = Reference(ws, min_col=2, min_row=21, max_row=24) for i in range(0, ca_len):
pie_data = Reference(ws, min_col=3 + j, min_row=20, max_row=24) # pie
pie.add_data(pie_data, titles_from_data=True) # 25~30: pie
pie.set_categories(labels) pie = PieChart()
pie.height = 6.6 # cm 1.05*5 1.05cm = 30 pt pie.title = ws.cell(column=3 + i, row=table_start_row_number).value
pie.width = 8 labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1, max_row=table_end_row_number)
# pie.title = "Pies sold by category" pie_data = Reference(ws, min_col=3 + i, min_row=table_start_row_number, max_row=table_end_row_number)
s1 = pie.series[0] pie.add_data(pie_data, titles_from_data=True)
s1.dLbls = DataLabelList() pie.set_categories(labels)
s1.dLbls.showCatName = True # 标签显示 pie.height = 6.6 # cm 1.05*5 1.05cm = 30 pt
s1.dLbls.showVal = True # 数量显示 pie.width = 8
s1.dLbls.showPercent = True # 百分比显示 # pie.title = "Pies sold by category"
# s1 = CharacterProperties(sz=1800) # 图表中字体大小 *100 s1 = pie.series[0]
chart_col = chr(ord('B') + 2 * j) s1.dLbls = DataLabelList()
chart_cell = chart_col + '25' s1.dLbls.showCatName = False # 标签显示
ws.add_chart(pie, chart_cell) s1.dLbls.showVal = True # 数量显示
else: s1.dLbls.showPercent = True # 百分比显示
for i in range(19, 36 + 1): # s1 = CharacterProperties(sz=1800) # 图表中字体大小 *100
ws.row_dimensions[i].height = 0.1 chart_cell = ''
for i in range(30, 35 + 1): if i % 2 == 0:
ws.row_dimensions[i].height = 0.1 chart_cell = 'B' + str(chart_start_row_number)
else:
chart_cell = 'E' + str(chart_start_row_number)
chart_start_row_number += 5
# ws.add_chart(pie, chart_cell)
# chart_col = chr(ord('B') + 2 * j)
# chart_cell = chart_col + '25'
ws.add_chart(pie, chart_cell)
current_row_number = chart_start_row_number
if ca_len % 2 == 1:
current_row_number += 5
current_row_number += 1
################################################ ################################################
# Fourth: 能耗详情 # Fourth: 能耗详情
# 37: title # current_row_number: title
# 38~ 38+ca_len*6-1: line # current_row_number+1 ~ current_row_number+1+ca_len*6-1: line
# 38+ca_len*6: table title # current_row_number+1+ca_len*6: table title
# 38+ca_len*6~: table_data # current_row_number+1+ca_len*6~: table_data
################################################ ################################################
reporting_period_data = report['reporting_period'] reporting_period_data = report['reporting_period']
times = reporting_period_data['timestamps'] times = reporting_period_data['timestamps']
has_detail_data_flag = True has_detail_data_flag = True
ca_len = len(report['reporting_period']['names']) ca_len = len(report['reporting_period']['names'])
table_row = 38 + ca_len*6 table_row = current_row_number + 1 + ca_len*6
chart_start_row_number = current_row_number + 1
if "timestamps" not in reporting_period_data.keys() or \ if "timestamps" not in reporting_period_data.keys() or \
reporting_period_data['timestamps'] is None or \ reporting_period_data['timestamps'] is None or \
len(reporting_period_data['timestamps']) == 0: len(reporting_period_data['timestamps']) == 0:
has_detail_data_flag = False has_detail_data_flag = False
if has_detail_data_flag: if has_detail_data_flag:
ws['B37'].font = title_font ws['B' + str(current_row_number)].font = title_font
ws['B37'] = name+' 能耗详情' ws['B' + str(current_row_number)] = name+' 详细数据'
ws.row_dimensions[table_row].height = 60 ws.row_dimensions[table_row].height = 60
ws['B'+str(table_row)].fill = table_fill ws['B'+str(table_row)].fill = table_fill
ws['B' + str(table_row)].font = title_font ws['B' + str(table_row)].font = title_font
ws['B'+str(table_row)].border = f_border ws['B'+str(table_row)].border = f_border
ws['B'+str(table_row)].alignment = c_c_alignment ws['B'+str(table_row)].alignment = c_c_alignment
ws['B'+str(table_row)] = '时间' ws['B'+str(table_row)] = '日期时间'
time = times[0] time = times[0]
has_data = False has_data = False
max_row = 0 max_row = 0
@ -526,31 +552,45 @@ def generate_excel(report,
ws[col + row].alignment = c_c_alignment ws[col + row].alignment = c_c_alignment
ws[col + row] = round(reporting_period_data['values'][i][j], 2) ws[col + row] = round(reporting_period_data['values'][i][j], 2)
ws[col + row].border = f_border ws[col + row].border = f_border
current_row_number = table_row + 1 + len(times[0])
ws['B' + str(current_row_number)].font = title_font
ws['B' + str(current_row_number)].alignment = c_c_alignment
ws['B' + str(current_row_number)].border = f_border
ws['B' + str(current_row_number)] = '小计'
for i in range(0, ca_len):
col = chr(ord('C') + i)
ws[col + str(current_row_number)].font = title_font
ws[col + str(current_row_number)].alignment = c_c_alignment
ws[col + str(current_row_number)].border = f_border
ws[col + str(current_row_number)] = reporting_period_data['subtotals'][i]
# line # line
# 39~: line # 39~: line
line = LineChart() line = LineChart()
line.title = '报告期消耗 - ' line.title = '报告期消耗 - ' + ws.cell(column=3+i, row=table_row).value
labels = Reference(ws, min_col=2, min_row=table_row+1, max_row=max_row + 1) labels = Reference(ws, min_col=2, min_row=table_row+1, max_row=max_row)
line_data = Reference(ws, min_col=3 + i, min_row=table_row, max_row=max_row + 1) # openpyxl bug line_data = Reference(ws, min_col=3 + i, min_row=table_row, max_row=max_row) # openpyxl bug
line.add_data(line_data, titles_from_data=True) line.add_data(line_data, titles_from_data=True)
line.set_categories(labels) line.set_categories(labels)
line_data = line.series[0] line_data = line.series[0]
line_data.marker.symbol = "circle" line_data.marker.symbol = "circle"
line_data.smooth = False line_data.smooth = True
line.x_axis.crosses = 'min'
line.height = 8.25 # cm 1.05*5 1.05cm = 30 pt line.height = 8.25 # cm 1.05*5 1.05cm = 30 pt
line.width = 24 line.width = 24
# pie.title = "Pies sold by category" # pie.title = "Pies sold by category"
line.dLbls = DataLabelList() line.dLbls = DataLabelList()
line.dLbls.dLblPos = 't'
# line.dLbls.showCatName = True # label show # line.dLbls.showCatName = True # label show
line.dLbls.showVal = True # val show line.dLbls.showVal = True # val show
line.dLbls.showPercent = True # percent show line.dLbls.showPercent = True # percent show
# s1 = CharacterProperties(sz=1800) # font size *100 # s1 = CharacterProperties(sz=1800) # font size *100
chart_col = 'B' chart_col = 'B'
chart_cell = chart_col + str(38 + 6*i) chart_cell = chart_col + str(chart_start_row_number + 6*i)
ws.add_chart(line, chart_cell) ws.add_chart(line, chart_cell)
else:
for i in range(37, 69 + 1):
ws.row_dimensions[i].height = 0.1
filename = str(uuid.uuid4()) + '.xlsx' filename = str(uuid.uuid4()) + '.xlsx'
wb.save(filename) wb.save(filename)

View File

@ -321,8 +321,13 @@ def generate_excel(report,
##################################### #####################################
has_child_flag = True has_child_flag = True
if "child_space" not in report.keys() or "energy_item_names" not in report['child_space'].keys() or \ if "child_space" not in report.keys() or "energy_item_names" not in report['child_space'].keys() or \
len(report['child_space']["energy_item_names"]) == 0: len(report['child_space']["energy_item_names"]) == 0 \
or 'child_space_names_array' not in report['child_space'].keys() \
or report['child_space']['child_space_names_array'] is None \
or len(report['child_space']['child_space_names_array']) == 0 \
or len(report['child_space']['child_space_names_array'][0]) == 0:
has_child_flag = False has_child_flag = False
if has_child_flag: if has_child_flag:
@ -332,6 +337,7 @@ def generate_excel(report,
ws['B' + str(current_row_number)] = name + ' 子空间数据' ws['B' + str(current_row_number)] = name + ' 子空间数据'
current_row_number += 1 current_row_number += 1
table_start_row_number = current_row_number
ws.row_dimensions[current_row_number].height = 60 ws.row_dimensions[current_row_number].height = 60
ws['B' + str(current_row_number)].fill = table_fill ws['B' + str(current_row_number)].fill = table_fill
@ -365,21 +371,22 @@ def generate_excel(report,
ws[col + row] = round(child['subtotals_array'][j][i], 2) ws[col + row] = round(child['subtotals_array'][j][i], 2)
ws[col + row].border = f_border ws[col + row].border = f_border
table_end_row_number = current_row_number
current_row_number += 1 current_row_number += 1
pie_start_row_number = current_row_number
# Pie # Pie
for i in range(0, ca_len): for i in range(0, ca_len):
pie = PieChart() pie = PieChart()
labels = Reference(ws, min_col=2, min_row=current_row_number - space_len, labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1,
max_row=current_row_number - 1) max_row=table_end_row_number)
pie_data = Reference(ws, min_col=3 + i, min_row=current_row_number - space_len - 1, pie_data = Reference(ws, min_col=3 + i, min_row=table_start_row_number,
max_row=current_row_number - 1) max_row=table_end_row_number)
pie.add_data(pie_data, titles_from_data=True) pie.add_data(pie_data, titles_from_data=True)
pie.set_categories(labels) pie.set_categories(labels)
pie.height = 6.6 pie.height = 6.6
pie.width = 8 pie.width = 8
col = chr(ord('C') + i) pie.title = ws.cell(column=3 + i, row=table_start_row_number).value
pie.title = ws[col + str(current_row_number - space_len - 1)].value
s1 = pie.series[0] s1 = pie.series[0]
s1.dLbls = DataLabelList() s1.dLbls = DataLabelList()
s1.dLbls.showCatName = False s1.dLbls.showCatName = False
@ -387,12 +394,13 @@ def generate_excel(report,
s1.dLbls.showPercent = True s1.dLbls.showPercent = True
chart_cell = '' chart_cell = ''
if i % 2 == 0: if i % 2 == 0:
chart_cell = 'B' + str(current_row_number) chart_cell = 'B' + str(pie_start_row_number)
else: else:
chart_cell = 'E' + str(current_row_number) chart_cell = 'E' + str(pie_start_row_number)
current_row_number += 5 pie_start_row_number += 5
ws.add_chart(pie, chart_cell) ws.add_chart(pie, chart_cell)
current_row_number = pie_start_row_number
if ca_len % 2 == 1: if ca_len % 2 == 1:
current_row_number += 5 current_row_number += 5
@ -506,7 +514,7 @@ def generate_excel(report,
for i in range(0, ca_len): for i in range(0, ca_len):
line = LineChart() line = LineChart()
line.title = '报告期消耗 - ' + \ line.title = '报告期消耗 - ' + \
reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + ")" reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + ")"
labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1, max_row=table_end_row_number) labels = Reference(ws, min_col=2, min_row=table_start_row_number + 1, max_row=table_end_row_number)
line_data = Reference(ws, min_col=3 + i, min_row=table_start_row_number, max_row=table_end_row_number) line_data = Reference(ws, min_col=3 + i, min_row=table_start_row_number, max_row=table_end_row_number)
line.add_data(line_data, titles_from_data=True) line.add_data(line_data, titles_from_data=True)
@ -541,4 +549,3 @@ def group_by_category(category_list):
category_dict[value] = list() category_dict[value] = list()
category_dict[value].append(i) category_dict[value].append(i)
return category_dict return category_dict

View File

@ -432,11 +432,12 @@ def generate_excel(report,
has_child_space_data_flag = True has_child_space_data_flag = True
if 'child_space' not in report.keys() or \ if "child_space" not in report.keys() or "energy_category_names" not in report['child_space'].keys() or \
report['child_space'] is None or \ len(report['child_space']["energy_category_names"]) == 0 \
'energy_category_names' not in report['child_space'].keys() or \ or 'child_space_names_array' not in report['child_space'].keys() \
report['child_space']['energy_category_names'] is None or \ or report['child_space']['energy_category_names'] is None \
len(report['child_space']['energy_category_names']) == 0: or len(report['child_space']['child_space_names_array']) == 0 \
or len(report['child_space']['child_space_names_array'][0]) == 0:
has_child_space_data_flag = False has_child_space_data_flag = False
if has_child_space_data_flag: if has_child_space_data_flag: