From e4168f07862502647496c7a4ee9f4d95e3695090 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 23 Jan 2021 16:49:10 +0100 Subject: [PATCH 1/4] Fix: config scripts when working in a symlinked directory --- config/config.sh | 2 +- config/delete_dept.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/config.sh b/config/config.sh index 423cd166..ab9dccb3 100644 --- a/config/config.sh +++ b/config/config.sh @@ -12,7 +12,7 @@ umask 0022 export SCODOC_DIR=/opt/scodoc/Products/ScoDoc -export SCODOC_VAR_DIR=$(realpath "$SCODOC_DIR/../../var/scodoc") +export SCODOC_VAR_DIR=$(realpath -L "$SCODOC_DIR/../../var/scodoc") # = /opt/scodoc/var/scodoc export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version" export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos" diff --git a/config/delete_dept.sh b/config/delete_dept.sh index d5e2bce2..cec81d01 100755 --- a/config/delete_dept.sh +++ b/config/delete_dept.sh @@ -82,6 +82,7 @@ then exit 0 else echo 'Attention: pas de configuration trouvee pour "'"$DEPT"'"' + echo " fichier cherché: $cfg_pathname" echo " => ne fait rien." exit 0 fi From 396880d0586f78d30aac2a4605a51e7ff0124c7a Mon Sep 17 00:00:00 2001 From: IDK Date: Sat, 23 Jan 2021 17:42:14 +0100 Subject: [PATCH 2/4] shellcheck --- config/config.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/config/config.sh b/config/config.sh index ab9dccb3..07f684c1 100644 --- a/config/config.sh +++ b/config/config.sh @@ -1,8 +1,14 @@ - +#!/bin/bash # Version majeure de Debian (..., 9, 10) debian_version=$(cat /etc/debian_version) debian_version=${debian_version%%.*} +die() { + echo + echo "Erreur: $1" + echo + exit 1 +} # Fix path export PATH="${PATH}":/usr/sbin:/sbin @@ -12,7 +18,8 @@ umask 0022 export SCODOC_DIR=/opt/scodoc/Products/ScoDoc -export SCODOC_VAR_DIR=$(realpath -L "$SCODOC_DIR/../../var/scodoc") +SCODOC_VAR_DIR=$(realpath -L "$SCODOC_DIR/../../var/scodoc") || die "can't set SCODOC_VAR_DIR" +export SCODOC_VAR_DIR # = /opt/scodoc/var/scodoc export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version" export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos" @@ -24,22 +31,22 @@ export POSTGRES_SUPERUSER=postgres export POSTGRES_USER=www-data # psql command: if various versions installed, force the one we want: -if [ ${debian_version} = "10" ] +if [ "${debian_version}" = "10" ] then PSQL=/usr/lib/postgresql/11/bin/psql -elif [ ${debian_version} = "9" ] +elif [ "${debian_version}" = "9" ] then PSQL=/usr/lib/postgresql/9.6/bin/psql -elif [ ${debian_version} = "8" ] +elif [ "${debian_version}" = "8" ] then PSQL=/usr/lib/postgresql/9.4/bin/psql -elif [ ${debian_version} = "7" ] +elif [ "${debian_version}" = "7" ] then PSQL=/usr/lib/postgresql/9.1/bin/psql -elif [ ${debian_version} = "5" ] +elif [ "${debian_version}" = "5" ] then PSQL=/usr/lib/postgresql/8.3/bin/psql - elif [ ${debian_version} = "6" ] + elif [ "${debian_version}" = "6" ] then PSQL=/usr/lib/postgresql/8.4/bin/psql else @@ -53,7 +60,7 @@ fi export POSTGRES_PORT=5432 # Utilise par le script de reset du mot de passe: -if [ ${debian_version} -ge "7" ] +if [ "${debian_version}" -ge "7" ] then export ZOPE_VERSION=2.13 else From d6b6796ae5d6cd8da525053acadd485f16daefdc Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 23 Jan 2021 21:40:57 +0100 Subject: [PATCH 3/4] Ignore coefficients of UE SPORTS when using UE coefs. --- notes_table.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/notes_table.py b/notes_table.py index bdb30300..004c60d9 100644 --- a/notes_table.py +++ b/notes_table.py @@ -896,8 +896,10 @@ class NotesTable: sum_coefs_ue = 0 for mu in moy_ues.values(): # mu["moy"] can be a number, or "NA", or "ERR" (user-defined UE formulas) - if isnumber(mu["moy"]) and ( - mu["est_inscrit"] or mu["is_capitalized"] + if ( + (mu["ue"]["type"] != UE_SPORT) + and isnumber(mu["moy"]) + and (mu["est_inscrit"] or mu["is_capitalized"]) ): coef_ue = mu["ue"]["coefficient"] sum_moy_ue += mu["moy"] * coef_ue From d57c2c3a4d68f12f570049f8ed910d15163d93af Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 23 Jan 2021 22:57:01 +0100 Subject: [PATCH 4/4] Fix --- ZAbsences.py | 21 +++++++++++---------- sco_moduleimpl.py | 5 ++++- sco_pvpdf.py | 4 ++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ZAbsences.py b/ZAbsences.py index ab194f5a..08cef678 100644 --- a/ZAbsences.py +++ b/ZAbsences.py @@ -70,6 +70,7 @@ from TrivialFormulator import TrivialFormulator, TF from gen_tables import GenTable import scolars import sco_formsemestre +import sco_moduleimpl import sco_groups import sco_groups_view import sco_excel @@ -547,8 +548,8 @@ class ZAbsences( desc = a["description"] if a["moduleimpl_id"] and a["moduleimpl_id"] != "NULL": # Trouver le nom du module - Mlist = self.Notes.do_moduleimpl_withmodule_list( - moduleimpl_id=a["moduleimpl_id"] + Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( + self.Notes, moduleimpl_id=a["moduleimpl_id"] ) if Mlist: M = Mlist[0] @@ -713,8 +714,8 @@ class ZAbsences( mod_inscrits = set( [ x["etudid"] - for x in self.Notes.do_moduleimpl_inscription_list( - moduleimpl_id=moduleimpl_id + for x in sco_moduleimpl.do_moduleimpl_inscription_list( + self.Notes, moduleimpl_id=moduleimpl_id ) ] ) @@ -847,8 +848,8 @@ class ZAbsences( mod_inscrits = set( [ x["etudid"] - for x in self.Notes.do_moduleimpl_inscription_list( - moduleimpl_id=moduleimpl_id + for x in sco_moduleimpl.do_moduleimpl_inscription_list( + self.Notes, moduleimpl_id=moduleimpl_id ) ] ) @@ -1221,8 +1222,8 @@ class ZAbsences( return "" ex = [] for ev in a["evals"]: - mod = self.Notes.do_moduleimpl_withmodule_list( - moduleimpl_id=ev["moduleimpl_id"] + mod = sco_moduleimpl.do_moduleimpl_withmodule_list( + self.Notes, moduleimpl_id=ev["moduleimpl_id"] )[0] if format == "html": ex.append( @@ -1238,8 +1239,8 @@ class ZAbsences( def descr_abs(a): ex = [] for ev in a.get("absent", []): - mod = self.Notes.do_moduleimpl_withmodule_list( - moduleimpl_id=ev["moduleimpl_id"] + mod = sco_moduleimpl.do_moduleimpl_withmodule_list( + self.Notes, moduleimpl_id=ev["moduleimpl_id"] )[0] if format == "html": ex.append( diff --git a/sco_moduleimpl.py b/sco_moduleimpl.py index b8a6a53b..df92a442 100644 --- a/sco_moduleimpl.py +++ b/sco_moduleimpl.py @@ -240,8 +240,11 @@ def do_moduleimpl_inscrit_etuds( # Inscriptions au module: inmod_set = set( [ + # hum ? x["etudid"] - for x in context.do_moduleimpl_inscription_list(moduleimpl_id=moduleimpl_id) + for x in do_moduleimpl_inscription_list( + context, moduleimpl_id=moduleimpl_id + ) ] ) for etudid in etudids: diff --git a/sco_pvpdf.py b/sco_pvpdf.py index 9ce9b14a..fa276791 100644 --- a/sco_pvpdf.py +++ b/sco_pvpdf.py @@ -813,8 +813,8 @@ def _pvjury_pdf_type( """ Le %s, %s""" % ( - context.get_preference("DirectorTitle", formsemestre_id), - context.get_preference("DirectorName", formsemestre_id), + context.get_preference("DirectorTitle", formsemestre_id) or "", + context.get_preference("DirectorName", formsemestre_id) or "", ), style, )