Merge bugfixes from 9.5.2

This commit is contained in:
Emmanuel Viennet 2023-07-13 12:57:16 +02:00
commit 467d56c0fa
4 changed files with 21 additions and 11 deletions

View File

@ -28,13 +28,14 @@
"""Table recap formation (avec champs éditables) """Table recap formation (avec champs éditables)
""" """
import io import io
from zipfile import ZipFile, BadZipfile from zipfile import ZipFile
from flask import Response from flask import Response
from flask import send_file, url_for from flask import send_file, url_for
from flask import g, request from flask import g, request
from flask_login import current_user from flask_login import current_user
from app import db
from app.models import Formation, FormSemestre, Matiere, Module, UniteEns from app.models import Formation, FormSemestre, Matiere, Module, UniteEns
from app.scodoc.gen_tables import GenTable from app.scodoc.gen_tables import GenTable

View File

@ -200,7 +200,7 @@ def do_formsemestres_associate_new_version(
# New formation: # New formation:
( (
formation_id, new_formation_id,
modules_old2new, modules_old2new,
ues_old2new, ues_old2new,
) = sco_formations.formation_create_new_version(formation_id, redirect=False) ) = sco_formations.formation_create_new_version(formation_id, redirect=False)
@ -219,7 +219,7 @@ def do_formsemestres_associate_new_version(
# re-associate # re-associate
for formsemestre_id in formsemestre_ids: for formsemestre_id in formsemestre_ids:
formsemestre = FormSemestre.get_formsemestre(formsemestre_id) formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
formsemestre.formation_id = formation_id formsemestre.formation_id = new_formation_id
db.session.add(formsemestre) db.session.add(formsemestre)
_reassociate_moduleimpls(formsemestre, ues_old2new, modules_old2new) _reassociate_moduleimpls(formsemestre, ues_old2new, modules_old2new)
@ -246,8 +246,12 @@ def _reassociate_moduleimpls(
Evaluation.moduleimpl_id == ModuleImpl.id, Evaluation.moduleimpl_id == ModuleImpl.id,
ModuleImpl.formsemestre_id == formsemestre.id, ModuleImpl.formsemestre_id == formsemestre.id,
): ):
poids.ue_id = ues_old2new[poids.ue_id] if poids.ue_id in ues_old2new:
db.session.add(poids) poids.ue_id = ues_old2new[poids.ue_id]
db.session.add(poids)
else:
# poids vers une UE qui n'est pas ou plus dans notre formation
db.session.delete(poids)
# update decisions: # update decisions:
for event in ScolarEvent.query.filter_by(formsemestre_id=formsemestre.id): for event in ScolarEvent.query.filter_by(formsemestre_id=formsemestre.id):
@ -258,8 +262,9 @@ def _reassociate_moduleimpls(
for validation in ScolarFormSemestreValidation.query.filter_by( for validation in ScolarFormSemestreValidation.query.filter_by(
formsemestre_id=formsemestre.id formsemestre_id=formsemestre.id
): ):
if validation.ue_id is not None: if (validation.ue_id is not None) and validation.ue_id in ues_old2new:
validation.ue_id = ues_old2new[validation.ue_id] validation.ue_id = ues_old2new[validation.ue_id]
# si l'UE n'est pas ou plus dans notre formation, laisse.
db.session.add(validation) db.session.add(validation)
db.session.commit() db.session.commit()

View File

@ -241,7 +241,7 @@ def get_default_group(formsemestre_id, fix_if_missing=False):
return group.id return group.id
# debug check # debug check
if len(r) != 1: if len(r) != 1:
raise ScoException(f"invalid group structure for {formsemestre_id}") log(f"invalid group structure for {formsemestre_id}: {len(r)}")
group_id = r[0]["group_id"] group_id = r[0]["group_id"]
return group_id return group_id
@ -587,7 +587,7 @@ def XMLgetGroupsInPartition(partition_id): # was XMLgetGroupesTD
x_group = Element( x_group = Element(
"group", "group",
partition_id=str(partition_id), partition_id=str(partition_id),
partition_name=partition["partition_name"], partition_name=partition["partition_name"] or "",
groups_editable=str(int(partition["groups_editable"])), groups_editable=str(int(partition["groups_editable"])),
group_id="_none_", group_id="_none_",
group_name="", group_name="",
@ -599,9 +599,9 @@ def XMLgetGroupsInPartition(partition_id): # was XMLgetGroupesTD
Element( Element(
"etud", "etud",
etudid=str(etud["etudid"]), etudid=str(etud["etudid"]),
sexe=etud["civilite_str"], sexe=etud["civilite_str"] or "",
nom=sco_etud.format_nom(etud["nom"]), nom=sco_etud.format_nom(etud["nom"] or ""),
prenom=sco_etud.format_prenom(etud["prenom"]), prenom=sco_etud.format_prenom(etud["prenom"] or ""),
origin=_comp_etud_origin(etud, formsemestre), origin=_comp_etud_origin(etud, formsemestre),
) )
) )

View File

@ -1,7 +1,11 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
<<<<<<< HEAD
SCOVERSION = "9.6.0" SCOVERSION = "9.6.0"
=======
SCOVERSION = "9.5.3"
>>>>>>> 2c93c35aa7972b502ddbda69b35cb40773317647
SCONAME = "ScoDoc" SCONAME = "ScoDoc"