From 67058fc25c821f983db99f929f9ffc10cc3e1766 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 16 Mar 2023 11:54:14 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20calcul=20co=C3=BBt=20formation=20quand?= =?UTF-8?q?=20donn=C3=A9es=20manquantes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_cost_formation.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/scodoc/sco_cost_formation.py b/app/scodoc/sco_cost_formation.py index 16429881b..334d3a0a0 100644 --- a/app/scodoc/sco_cost_formation.py +++ b/app/scodoc/sco_cost_formation.py @@ -34,8 +34,6 @@ from flask import request from app.models import FormSemestre from app.scodoc.gen_tables import GenTable -from app.scodoc import sco_formsemestre -from app.scodoc import sco_moduleimpl from app.scodoc import sco_preferences import app.scodoc.sco_utils as scu import sco_version @@ -65,16 +63,18 @@ def formsemestre_table_estim_cost( { "code": modimpl.module.code or "", "titre": modimpl.module.titre, - "heures_cours": modimpl.module.heures_cours, - "heures_td": modimpl.module.heures_td * n_group_td, - "heures_tp": modimpl.module.heures_tp * n_group_tp, + "heures_cours": modimpl.module.heures_cours or 0.0, + "heures_td": (modimpl.module.heures_td or 0.0) * n_group_td, + "heures_tp": (modimpl.module.heures_tp or 0.0) * n_group_tp, } ) # calcul des heures: - for t in rows: - t["HeqTD"] = ( - t["heures_td"] + coef_cours * t["heures_cours"] + coef_tp * t["heures_tp"] + for row in rows: + row["HeqTD"] = ( + row["heures_td"] + + coef_cours * row["heures_cours"] + + coef_tp * row["heures_tp"] ) sum_cours = sum([t["heures_cours"] for t in rows]) sum_td = sum([t["heures_td"] for t in rows])