From 328c9606699a024a9fc4c0662c0a457b5ffc159b Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand Date: Fri, 24 Mar 2017 19:30:31 +0300 Subject: [PATCH] Latex tab still has a bug with jinja2 --- notes_tools/reports/eval_reports.py | 22 +++++++++++++++------- notes_tools/tools/evaluation.py | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/notes_tools/reports/eval_reports.py b/notes_tools/reports/eval_reports.py index 438daad..49cf2cb 100755 --- a/notes_tools/reports/eval_reports.py +++ b/notes_tools/reports/eval_reports.py @@ -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) diff --git a/notes_tools/tools/evaluation.py b/notes_tools/tools/evaluation.py index e9cc3e8..8acfc3c 100644 --- a/notes_tools/tools/evaluation.py +++ b/notes_tools/tools/evaluation.py @@ -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): """