Latex tab still has a bug with jinja2
This commit is contained in:
parent
76813726eb
commit
328c960669
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# 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
|
from .texenv import feed_template
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -37,7 +37,6 @@ def build_target_name(classe, evalname, path = Path("./")):
|
|||||||
"""
|
"""
|
||||||
return Path(path + "/" + classe + "/report_" + evalname + ".tex")
|
return Path(path + "/" + classe + "/report_" + evalname + ".tex")
|
||||||
|
|
||||||
|
|
||||||
def eval_report(classe, evalname, path = Path('./'), template = "tpl_reports_eval.tex"):
|
def eval_report(classe, evalname, path = Path('./'), template = "tpl_reports_eval.tex"):
|
||||||
""" Generate the report of a evaluation for a class
|
""" 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))
|
logger.info("Worksheets of {} imported".format(classe))
|
||||||
|
|
||||||
flat_df = extract_flat_marks(ws)
|
flat_df = extract_flat_marks(ws)
|
||||||
quest_df, exo_df, eval_df = digest_flat_df(flat_df)
|
|
||||||
logger.info("Worksheets parsed")
|
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)
|
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,
|
students = evaluation.students_pov(quest_df, exo_df, eval_df)
|
||||||
"quest_df":quest_df, "exo_df":exo_df, "eval_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)
|
target = build_target_name(classe, evalname, path)
|
||||||
feed_template(target, datas, template)
|
feed_template(target, datas, template)
|
||||||
|
@ -34,7 +34,7 @@ class Student(object):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(evalname) != 1:
|
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.quest_df = quest_df
|
||||||
self.exo_df = exo_df
|
self.exo_df = exo_df
|
||||||
@ -82,13 +82,13 @@ class Student(object):
|
|||||||
line += q['Latex_rep']
|
line += q['Latex_rep']
|
||||||
else:
|
else:
|
||||||
line += str(q['Mark'])
|
line += str(q['Mark'])
|
||||||
|
line += r"\\"
|
||||||
tabular.append(line)
|
tabular.append(line)
|
||||||
tabular.append(r"\hline")
|
tabular.append(r"\hline")
|
||||||
|
|
||||||
tabular.append(r"\end{tabular}")
|
tabular.append(r"\end{tabular}")
|
||||||
return '\n'.join(tabular)
|
return '\n'.join(tabular)
|
||||||
|
|
||||||
|
|
||||||
class Classe(object):
|
class Classe(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user