From 10623e568b5f7d213015d1196f5d1ac3b5d7a6e8 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 19 Jul 2024 10:19:30 +0200 Subject: [PATCH] Remove unused sco_compute_moy.py --- app/scodoc/sco_compute_moy.py | 102 -------------------------- app/scodoc/sco_formsemestre_status.py | 13 ---- app/scodoc/sco_moduleimpl_status.py | 22 ++---- 3 files changed, 5 insertions(+), 132 deletions(-) delete mode 100644 app/scodoc/sco_compute_moy.py diff --git a/app/scodoc/sco_compute_moy.py b/app/scodoc/sco_compute_moy.py deleted file mode 100644 index 5f2959df..00000000 --- a/app/scodoc/sco_compute_moy.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- mode: python -*- -# -*- coding: utf-8 -*- - -############################################################################## -# -# Gestion scolarite IUT -# -# Copyright (c) 1999 - 2024 Emmanuel Viennet. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Emmanuel Viennet emmanuel.viennet@viennet.net -# -############################################################################## - -"""Calcul des moyennes de module (restes de fonctions ScoDoc 7) -""" -from app.models import ModuleImpl -import app.scodoc.notesdb as ndb - - -def moduleimpl_has_expression(modimpl: ModuleImpl): - """True if we should use a user-defined expression - En ScoDoc 9, utilisé pour afficher un avertissement, l'expression elle même - n'est plus supportée. - """ - return ( - modimpl.computation_expr - and modimpl.computation_expr.strip() - and modimpl.computation_expr.strip()[0] != "#" - ) - - -def formsemestre_expressions_use_abscounts(formsemestre_id): - """True si les notes de ce semestre dépendent des compteurs d'absences. - Cela n'est normalement pas le cas, sauf si des formules utilisateur - utilisent ces compteurs. - """ - # check presence of 'nbabs' in expressions - ab = "nb_abs" # chaine recherchée - cnx = ndb.GetDBConnexion() - # 1- moyennes d'UE: - elist = formsemestre_ue_computation_expr_list( - cnx, {"formsemestre_id": formsemestre_id} - ) - for e in elist: - expr = e["computation_expr"].strip() - if expr and expr[0] != "#" and ab in expr: - return True - # 2- moyennes de modules - # #sco9 il n'y a plus d'expressions - # for mod in sco_moduleimpl.moduleimpl_list(formsemestre_id=formsemestre_id): - # if moduleimpl_has_expression(mod) and ab in mod["computation_expr"]: - # return True - return False - - -_formsemestre_ue_computation_exprEditor = ndb.EditableTable( - "notes_formsemestre_ue_computation_expr", - "notes_formsemestre_ue_computation_expr_id", - ( - "notes_formsemestre_ue_computation_expr_id", - "formsemestre_id", - "ue_id", - "computation_expr", - ), - html_quote=False, # does nt automatically quote -) -formsemestre_ue_computation_expr_create = _formsemestre_ue_computation_exprEditor.create -formsemestre_ue_computation_expr_delete = _formsemestre_ue_computation_exprEditor.delete -formsemestre_ue_computation_expr_list = _formsemestre_ue_computation_exprEditor.list -formsemestre_ue_computation_expr_edit = _formsemestre_ue_computation_exprEditor.edit - - -def get_ue_expression(formsemestre_id, ue_id, html_quote=False): - """Returns UE expression (formula), or None if no expression has been defined""" - cnx = ndb.GetDBConnexion() - el = formsemestre_ue_computation_expr_list( - cnx, {"formsemestre_id": formsemestre_id, "ue_id": ue_id} - ) - if not el: - return None - else: - expr = el[0]["computation_expr"].strip() - if expr and expr[0] != "#": - if html_quote: - expr = ndb.quote_html(expr) - return expr - else: - return None diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 30ba7ebf..53d00800 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -64,7 +64,6 @@ from app.scodoc import sco_archives_formsemestre from app.scodoc import sco_assiduites as scass from app.scodoc import sco_bulletins from app.scodoc import codes_cursus -from app.scodoc import sco_compute_moy from app.scodoc import sco_evaluations from app.scodoc import sco_formations from app.scodoc import sco_formsemestre @@ -1255,18 +1254,6 @@ def formsemestre_tableau_modules( """ ) - expr = sco_compute_moy.get_ue_expression( - formsemestre.id, ue.id, html_quote=True - ) - if expr: - H.append( - f""" {expr} - formule inutilisée en ScoDoc 9: supprimer""" - ) - H.append("") if ue.type != codes_cursus.UE_STANDARD: diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 470be3e8..514321f9 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -42,13 +42,11 @@ from app.models import Evaluation, FormSemestre, Module, ModuleImpl, UniteEns import app.scodoc.sco_utils as scu from app.scodoc import sco_assiduites as scass from app.scodoc.codes_cursus import UE_SPORT -from app.scodoc.sco_exceptions import ScoInvalidIdType from app.scodoc.sco_cursus_dut import formsemestre_has_decisions from app.scodoc.sco_permissions import Permission from app.scodoc import html_sco_header from app.scodoc import htmlutils -from app.scodoc import sco_compute_moy from app.scodoc import sco_evaluations from app.scodoc import sco_groups from app.scodoc import sco_moduleimpl @@ -333,21 +331,11 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None): scodoc_dept=g.scodoc_dept, moduleimpl_id=modimpl.id )}">modifier""" ) - H.append("") - # Ligne: règle de calcul - has_expression = sco_compute_moy.moduleimpl_has_expression(modimpl) - if has_expression: - H.append( - """ - Règle de calcul: - inutilisée dans cette version de ScoDoc - - - """ - ) - else: - H.append('') - H.append("") + H.append( + """ + + """ + ) disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)