Add possility to list available bilan
This commit is contained in:
parent
a061b18c45
commit
603e6cab84
@ -58,16 +58,26 @@ def main():
|
||||
action="store_true",
|
||||
dest="debug_level",
|
||||
help="Enable debug")
|
||||
parser.add_option("-l",
|
||||
"--list",
|
||||
action="store_true",
|
||||
dest="list",
|
||||
help="List classe and possible bilan")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if not options.classe:
|
||||
logger.error("Need to pass a class with -c. See -h for help")
|
||||
sys.exit()
|
||||
if options.debug_level:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
if options.term:
|
||||
if options.list:
|
||||
from .bilan_tools import print_bilan
|
||||
logger.info("Listing all bilan in {}".format(options.path))
|
||||
print_bilan(options.path)
|
||||
|
||||
elif options.term:
|
||||
if not options.classe:
|
||||
logger.error("Need to pass a class with -c. See -h for help")
|
||||
sys.exit()
|
||||
logger.info("Creating term {} bilan".format(options.term))
|
||||
from .term_bilan import term_bilan
|
||||
if options.template:
|
||||
@ -82,6 +92,9 @@ def main():
|
||||
template)
|
||||
|
||||
elif options.eval:
|
||||
if not options.classe:
|
||||
logger.error("Need to pass a class with -c. See -h for help")
|
||||
sys.exit()
|
||||
logger.info("Creating {} bilan".format(options.eval))
|
||||
from .eval_bilan import eval_bilan
|
||||
if options.template:
|
||||
@ -96,7 +109,7 @@ def main():
|
||||
template)
|
||||
|
||||
else:
|
||||
logger.error("Need to pass a evaluation name with -e or the term number with -t. See -h for help")
|
||||
logger.error("Not enough arguments. See -h for help")
|
||||
sys.exit()
|
||||
|
||||
|
||||
|
50
notes_tools/generate_bilan/bilan_tools.py
Executable file
50
notes_tools/generate_bilan/bilan_tools.py
Executable file
@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
from notes_tools.tools import extract_flat_marks, get_class_ws, list_classes
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import xlrd
|
||||
from path import Path
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger("generate_bilan")
|
||||
|
||||
|
||||
def print_bilan_of(classe_ws):
|
||||
"""TODO: Docstring for list_bilan.
|
||||
|
||||
:param arg1: TODO
|
||||
:returns: TODO
|
||||
|
||||
"""
|
||||
try:
|
||||
df = extract_flat_marks(classe_ws)
|
||||
# TODO: il faudrait renommer l'exeption |lun. nov. 28 16:17:21 EAT 2016
|
||||
except ValueError:
|
||||
print("Erreur avec cette feuille de calcul")
|
||||
return None
|
||||
print("Évaluations")
|
||||
for e in df["Nom"].unique():
|
||||
print("\t-{}".format(e))
|
||||
print("Trimestre")
|
||||
for t in df['Trimestre'].unique():
|
||||
print("\t-Trimestre {}".format(t))
|
||||
|
||||
def print_bilan(path):
|
||||
""" List all bilan which can be generate in the directory
|
||||
|
||||
:param path: the directory
|
||||
:returns: TODO
|
||||
|
||||
"""
|
||||
print("Liste des bilans disponibles")
|
||||
for c in list_classes(path):
|
||||
print("Classe de {}".format(c))
|
||||
ws = get_class_ws(c, path)
|
||||
print_bilan_of(ws)
|
||||
|
||||
# -----------------------------
|
||||
# Reglages pour 'vim'
|
||||
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
||||
# cursor: 16 del
|
@ -2,7 +2,7 @@
|
||||
# encoding: utf-8
|
||||
|
||||
|
||||
from .extract import extract_flat_marks, get_class_ws
|
||||
from .extract import extract_flat_marks, get_class_ws, list_classes
|
||||
from .df_marks_manip import digest_flat_df#, students_pov
|
||||
#from .eval_tools import select_eval, get_present_absent, keep_only_presents
|
||||
from .plottings import radar_graph
|
||||
|
@ -51,7 +51,7 @@ def check_students(dfs, notStudent = notStudent):
|
||||
dfs_students = [extract_students(df) for df in dfs]
|
||||
|
||||
if not are_equal(dfs_students):
|
||||
raise ValueError("Not same list of students between df1 = {} ans df2 = {}".format(df1, df2))
|
||||
raise ValueError("Not same list of students amoung worksheets")
|
||||
|
||||
return dfs_students[0]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user