Modifie refcomp_desassoc (#506)
This commit is contained in:
parent
9db334dd65
commit
b36e39cae8
@ -233,6 +233,21 @@ class Formation(db.Model):
|
||||
.filter(ApcAnneeParcours.parcours_id == parcour.id)
|
||||
)
|
||||
|
||||
def refcomp_desassoc(self):
|
||||
"""Désassocie la formation de son ref. de compétence"""
|
||||
self.referentiel_competence = None
|
||||
db.session.add(self)
|
||||
# Niveaux des UE
|
||||
for ue in self.ues:
|
||||
ue.niveau_competence = None
|
||||
db.session.add(ue)
|
||||
# Parcours et AC des modules
|
||||
for mod in self.modules:
|
||||
mod.parcours = []
|
||||
mod.app_critiques = []
|
||||
db.session.add(mod)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
class Matiere(db.Model):
|
||||
"""Matières: regroupe les modules d'une UE
|
||||
|
@ -66,7 +66,8 @@ class Module(db.Model):
|
||||
super(Module, self).__init__(**kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Module{ModuleType(self.module_type or ModuleType.STANDARD).name} id={self.id} code={self.code!r} semestre_id={self.semestre_id}>"
|
||||
return f"""<Module{ModuleType(self.module_type or ModuleType.STANDARD).name
|
||||
} id={self.id} code={self.code!r} semestre_id={self.semestre_id}>"""
|
||||
|
||||
def to_dict(self, convert_objects=False, with_matiere=False, with_ue=False) -> dict:
|
||||
"""If convert_objects, convert all attributes to native types
|
||||
|
@ -677,36 +677,34 @@ def _gen_form_saisie_groupe(
|
||||
moduleimpl_id: optionnel, module concerné.
|
||||
"""
|
||||
H = [
|
||||
"""
|
||||
f"""
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(".abs_form_table input").prop( "disabled", %s );
|
||||
});
|
||||
function colorize(obj) {
|
||||
if (obj.checked) {
|
||||
$(function() {{
|
||||
$(".abs_form_table input").prop( "disabled", {
|
||||
"true" if (require_module and not moduleimpl_id) else "false"
|
||||
} );
|
||||
}});
|
||||
function colorize(obj) {{
|
||||
if (obj.checked) {{
|
||||
obj.parentNode.className = 'absent';
|
||||
} else {
|
||||
}} else {{
|
||||
obj.parentNode.className = 'present';
|
||||
}
|
||||
}
|
||||
function on_toggled(obj, etudid, dat) {
|
||||
}}
|
||||
}}
|
||||
function on_toggled(obj, etudid, dat) {{
|
||||
colorize(obj);
|
||||
if (obj.checked) {
|
||||
if (obj.checked) {{
|
||||
ajaxFunction('add', etudid, dat);
|
||||
} else {
|
||||
}} else {{
|
||||
ajaxFunction('remove', etudid, dat);
|
||||
}
|
||||
}
|
||||
}}
|
||||
}}
|
||||
</script>
|
||||
<div id="AjaxDiv"></div>
|
||||
<br>
|
||||
<table rules="cols" frame="box" class="abs_form_table">
|
||||
<tr><th class="formabs_contetud">%d étudiants</th>
|
||||
<tr><th class="formabs_contetud">{len(etuds)} étudiants</th>
|
||||
"""
|
||||
% (
|
||||
"true" if (require_module and not moduleimpl_id) else "false",
|
||||
len(etuds),
|
||||
)
|
||||
]
|
||||
# Dates
|
||||
odates = [datetime.date(*[int(x) for x in d.split("-")]) for d in dates]
|
||||
@ -720,16 +718,16 @@ def _gen_form_saisie_groupe(
|
||||
noms_jours.append(jn[idx_jour])
|
||||
for jour in noms_jours:
|
||||
H.append(
|
||||
'<th colspan="2" width="100px" style="padding-left: 5px; padding-right: 5px;">'
|
||||
+ jour
|
||||
+ "</th>"
|
||||
f"""<th colspan="2" width="100px" style="padding-left: 5px; padding-right: 5px;">
|
||||
{ jour }
|
||||
</th>"""
|
||||
)
|
||||
H.append("</tr><tr><td> </td>")
|
||||
for d in odates:
|
||||
H.append(
|
||||
'<th colspan="2" width="100px" style="padding-left: 5px; padding-right: 5px;">'
|
||||
+ d.strftime("%d/%m/%Y")
|
||||
+ "</th>"
|
||||
f"""<th colspan="2" width="100px" style="padding-left: 5px; padding-right: 5px;">
|
||||
{ d.strftime("%d/%m/%Y") }
|
||||
</th>"""
|
||||
)
|
||||
H.append("</tr><tr><td> </td>")
|
||||
H.append("<th>AM</th><th>PM</th>" * len(dates))
|
||||
@ -1483,16 +1481,6 @@ def process_billet_absence_form(billet_id):
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
# @bp.route("/essai_api7")
|
||||
# @scodoc
|
||||
# @permission_required_compat_scodoc7(Permission.ScoView)
|
||||
# @scodoc7func
|
||||
# def essai_api7(x="xxx"):
|
||||
# "un essai"
|
||||
# log("arfffffffffffffffffff")
|
||||
# return "OK OK x=" + str(x)
|
||||
|
||||
|
||||
@bp.route("/XMLgetAbsEtud", methods=["GET", "POST"]) # pour compat anciens clients PHP
|
||||
@scodoc
|
||||
@permission_required_compat_scodoc7(Permission.ScoView)
|
||||
@ -1503,7 +1491,6 @@ def XMLgetAbsEtud(beg_date="", end_date=""):
|
||||
etuds = sco_etud.get_etud_info(filled=False)
|
||||
if not etuds:
|
||||
raise APIInvalidParams("étudiant inconnu")
|
||||
# raise ScoValueError("étudiant inconnu")
|
||||
etud = etuds[0]
|
||||
exp = re.compile(r"^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])$")
|
||||
if not exp.match(beg_date):
|
||||
|
@ -166,9 +166,7 @@ def refcomp_assoc_formation(formation_id: int):
|
||||
def refcomp_desassoc_formation(formation_id: int):
|
||||
"""Désassocie la formation de son ref. de compétence"""
|
||||
formation = Formation.query.get_or_404(formation_id)
|
||||
formation.referentiel_competence = None
|
||||
db.session.add(formation)
|
||||
db.session.commit()
|
||||
formation.refcomp_desassoc()
|
||||
return redirect(
|
||||
url_for("notes.ue_table", scodoc_dept=g.scodoc_dept, formation_id=formation.id)
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.3.59"
|
||||
SCOVERSION = "9.3.60"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user