Commit 50683c21 authored by Lorenz Steinert's avatar Lorenz Steinert

changed sorting order of fsr

parent 2e5753d4
......@@ -83,12 +83,24 @@ def gen_head(share_dir, reg, sprecher, protokollant, date):
return f_head
def resort_fsr(fsr, num_cols=5):
fsr += [""] * (num_cols - len(fsr)%num_cols)
depth = len(fsr)//num_cols
tmp = [[] for i in range(depth)]
for index, elem in zip(range(len(fsr)), fsr):
tmp[index%depth] += [elem]
return [j for i in tmp for j in i]
def gen_attendance_tab(fsr, num_cols=5, ext=False):
"""generate the atandance tables"""
fsr = resort_fsr(fsr, num_cols)
fsr_tab, tabdef = '', '||'
for i in range(num_cols):
tabdef += "c|l||"
tabdef = '||' + 'c|l||'*num_cols
if ext:
fsr_tab += "Externe Referenten\\\\\n\\\\\n" \
......@@ -98,24 +110,24 @@ def gen_attendance_tab(fsr, num_cols=5, ext=False):
fsr_tab += "FSR-Mitglieder\\\\\n\\\\\n\\scriptsize{\\begin{tabular}{" \
+ tabdef + "}\n\\hline\n"
for i in zip(fsr, range(len(fsr))):
if i[1] % num_cols == 0:
for elem, index in zip(fsr, range(len(fsr))):
if index % num_cols == 0:
fsr_tab += " "
else:
fsr_tab += "&"
fsr_tab += " &" + i[0]
fsr_tab += " &" + elem
if i[1] % num_cols == num_cols - 1:
if index % num_cols == num_cols - 1:
fsr_tab += "\\\\\\hline\n"
else:
fsr_tab += "\n"
#add empty cells to padd the last row
if not len(fsr) % num_cols == 0:
for i in range(num_cols - len(fsr) % num_cols):
fsr_tab += "& &\n"
fsr_tab += "\\\\\\hline\n"
# if not len(fsr) % num_cols == 0:
# for i in range(num_cols - len(fsr) % num_cols):
# fsr_tab += "& &\n"
# fsr_tab += "\\\\\\hline\n"
if ext:
fsr_tab += "\\end{tabular}}\\normalsize"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment