Mid code cleanup

This commit is contained in:
lwark
2024-09-26 13:54:28 -05:00
parent f4e930c64e
commit 3c98d2a4ad
6 changed files with 49 additions and 62 deletions

View File

@@ -547,23 +547,9 @@ class DocxWriter(object):
if columns == 0:
columns = max([sample['column'] for sample in sample_list])
for row in range(0, rows):
# NOTE: Create a list with length equal to columns length
# contents = [''] * columns
# NOTE: Create a list with length equal to columns length, padding with '' where necessary
contents = [next((item['submitter_id'] for item in sample_list if item['row'] == row + 1 and
item['column'] == column + 1), '') for column in range(0, columns)]
# for column in range(0, columns):
# contents[column] = next((item['submitter_id'] for item in sample_list if item['row'] == row + 1 and item['column'] == column), '')
# try:
# # ooi = [item for item in sample_list if item['row'] == row + 1 and item['column'] == column + 1][0]
# ooi = next(item for item in sample_list if item['row'] == row + 1 and item['column'] == column)
# except StopIteration:
# continue
# contents[column] = ooi['submitter_id']
# NOTE: Pad length of contents to reflect columns
# if len(contents) < columns:
# contents += [''] * (columns - len(contents))
# if not contents:
# contents = [''] * columns
yield contents
def create_merged_template(self, *args) -> BytesIO: