Skip to content
Snippets Groups Projects

Zadávání bodů a zobrazení výsledků

Merged Jiří Setnička requested to merge jirka/score into devel
All threads resolved!
1 file
+ 9
2
Compare changes
  • Side-by-side
  • Inline
+ 9
2
@@ -78,12 +78,18 @@ class Table:
rows: Iterable[dict]
filename: str
show_downlink: bool
row_extras_key: Optional[str]
def __init__(self, columns: Sequence[Column], rows: Iterable[dict], filename: str, show_downlink: bool = True):
def __init__(
self, columns: Sequence[Column], rows: Iterable[dict],
filename: str, show_downlink: bool = True,
row_extras_key: Optional[str] = None
):
self.columns = columns
self.rows = rows
self.filename = filename
self.show_downlink = show_downlink
self.row_extras_key = row_extras_key
def to_html(self) -> str:
tab = ['<table class=data>', '<thead>', '<tr>']
@@ -94,7 +100,8 @@ class Table:
tab.append('<tbody>')
for r in self.rows:
tab.append('<tr>')
row_extras = r.get(self.row_extras_key) if self.row_extras_key else ""
tab.append(f'<tr{row_extras}>')
for c in self.columns:
val = r.get(c.key)
if isinstance(val, Cell):
Loading