Latex tab still has a bug with jinja2

This commit is contained in:
Benjamin Bertrand 2017-03-24 19:30:31 +03:00
parent 76813726eb
commit 328c960669
2 changed files with 17 additions and 9 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# encoding: utf-8
from notes_tools.tools import extract_flat_marks, get_class_ws, digest_flat_df, eval_tools #students_pov, select_eval
from notes_tools.tools import extract_flat_marks, get_class_ws, digest_flat_df, evaluation #students_pov, select_eval
from .texenv import feed_template
import pandas as pd
import numpy as np
@ -37,7 +37,6 @@ def build_target_name(classe, evalname, path = Path("./")):
"""
return Path(path + "/" + classe + "/report_" + evalname + ".tex")
def eval_report(classe, evalname, path = Path('./'), template = "tpl_reports_eval.tex"):
""" Generate the report of a evaluation for a class
@ -51,16 +50,25 @@ def eval_report(classe, evalname, path = Path('./'), template = "tpl_reports_eva
logger.info("Worksheets of {} imported".format(classe))
flat_df = extract_flat_marks(ws)
quest_df, exo_df, eval_df = digest_flat_df(flat_df)
logger.info("Worksheets parsed")
quest_df, exo_df, eval_df = eval_tools.select(quest_df, exo_df, eval_df, evalname)
this_df = flat_df[flat_df['Nom'] == evalname]
quest_df, exo_df, eval_df = digest_flat_df(this_df)
report_info = eval_info(classe, eval_df)
students = eval_tools.students_pov(quest_df, exo_df, eval_df)
datas = {"report_info": report_info, "students":students,
"quest_df":quest_df, "exo_df":exo_df, "eval_df":eval_df}
students = evaluation.students_pov(quest_df, exo_df, eval_df)
#class_pov = term.class_pov(quest_df, exo_df, eval_df)
studs = {*this_df['Eleve']}
present = {*eval_df['Eleve']}
absents = studs - present
datas = {"report_info": report_info,
"students":students,
#"classe": class_pov,
"absents": absents
}
target = build_target_name(classe, evalname, path)
feed_template(target, datas, template)

View File

@ -34,7 +34,7 @@ class Student(object):
}
if len(evalname) != 1:
raise ValueError("Can't initiate Student: dfs contains different evaluation names")
raise ValueError(f"Can't initiate Student: dfs contains different evaluation names ({'-'.join(evalname)})")
self.quest_df = quest_df
self.exo_df = exo_df
@ -82,13 +82,13 @@ class Student(object):
line += q['Latex_rep']
else:
line += str(q['Mark'])
line += r"\\"
tabular.append(line)
tabular.append(r"\hline")
tabular.append(r"\end{tabular}")
return '\n'.join(tabular)
class Classe(object):
"""