Skip to content

Commit

Permalink
Fix some issues with tables
Browse files Browse the repository at this point in the history
  • Loading branch information
denismaitak committed Jun 27, 2023
1 parent 640b1db commit 9ab4b2e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/jira_report_generator/tables/assignees.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def _generate_row(name, df, components, estimate, spent, **attrs) -> TR:
rows.append(row)
scrollable_rows.append(scollable_row)

if not components:
return Table(rows, **table_options)

return Div(
Div(
Table(rows, **table_options),
Expand Down
6 changes: 5 additions & 1 deletion src/jira_report_generator/tables/epics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def generate_epics_table(df: DataFrame, **table_options: str):
rows = []
header = TR()
epics = df[df["type"].apply(lambda x: x.name == "Epic")]
epics_list = list(epics.iterrows())
completed_statuses = (
Status.CLIENT_REVIEW.value,
Status.COMPLETED.value,
Expand All @@ -30,7 +31,7 @@ def generate_epics_table(df: DataFrame, **table_options: str):

rows.append(header)

for _, epic in epics.iterrows():
for _, epic in epics_list:
row = TR(**{"data-epic-id": epic.id})
epic_tasks = df[df["parent"].apply(
lambda x: x is not None and x.id == epic.id
Expand Down Expand Up @@ -65,4 +66,7 @@ def generate_epics_table(df: DataFrame, **table_options: str):

rows.append(row)

if not epics_list:
rows = []

return Table(rows, **table_options)
3 changes: 3 additions & 0 deletions src/jira_report_generator/tables/statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def _generate_row(name, df, components, estimate, spent, **attrs) -> TR:
rows.append(footer_row)
scrollable_rows.append(footer_scrollable_row)

if not components:
return Table(rows, **table_options)

return Div(
Div(
Table(rows, **table_options),
Expand Down
13 changes: 8 additions & 5 deletions src/jira_report_generator/tables/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def generate_component_columns(

# generate empty columns
if component_tasks.empty:
columns.append(TD())
columns.append(TD())
columns.append(TD())
columns.append(TD())
columns.append(TD())
columns.append(TD(" "))
columns.append(TD(" "))
columns.append(TD(" "))
columns.append(TD(" "))
columns.append(TD(" "))
continue

component_estimate = round(
Expand Down Expand Up @@ -271,6 +271,9 @@ def generate_versions_table(

rows.append(row)

if not components:
return Table(rows, **table_options)

return Div(
Div(
Table(rows, **table_options),
Expand Down
6 changes: 6 additions & 0 deletions src/jira_report_generator/utils/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def __str__(self):
self.value = "".join(map(str, self.rows))
return super().__str__()

def __bool__(self):
return bool(self.rows)

def append(self, row: TR):
self.rows.append(row)

Expand All @@ -80,5 +83,8 @@ def __str__(self):
self.value = "".join(map(str, self.elements))
return super().__str__()

def __bool__(self):
return bool(self.elements)

def append(self, element):
self.rows.append(element)

0 comments on commit 9ab4b2e

Please sign in to comment.