Update line_count.py

Fixed a bug with omitted cues
This commit is contained in:
Jamie Hardt
2022-08-17 22:21:16 -07:00
parent 3b438b1399
commit 9f8e3cf824

View File

@@ -148,7 +148,7 @@ def populate_columns(lines: List[ADRLine], columns, include_omitted, _page_size)
styles = list() styles = list()
columns_widths = list() columns_widths = list()
sorted_character_numbers = sorted(set([x.character_id for x in lines]), sorted_character_numbers: List[str] = sorted(set([x.character_id for x in lines]),
key=lambda x: str(x)) key=lambda x: str(x))
# construct column styles # construct column styles
@@ -164,13 +164,16 @@ def populate_columns(lines: List[ADRLine], columns, include_omitted, _page_size)
for n in sorted_character_numbers: for n in sorted_character_numbers:
char_records = [x for x in lines if x.character_id == n] char_records = [x for x in lines if x.character_id == n]
if len(char_records) > 0:
row_data = list() row_data = list()
row_data2 = list() row_data2 = list()
for col in columns: for col in columns:
row1_index = len(data) row1_index = len(data)
row2_index = row1_index + 1 row2_index = row1_index + 1
row_data.append(col['value_getter'](list(char_records))) row_data.append(col['value_getter'](list(char_records)))
row_data2.append(col['value_getter2'](list(char_records))) row_data2.append(col['value_getter2'](list(char_records)))
styles.extend([('TEXTCOLOR', (0, row2_index), (-1, row2_index), colors.red), styles.extend([('TEXTCOLOR', (0, row2_index), (-1, row2_index), colors.red),
('LINEBELOW', (0, row2_index), (-1, row2_index), 0.5, colors.black)]) ('LINEBELOW', (0, row2_index), (-1, row2_index), 0.5, colors.black)])