Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Milleville
SCODOC_R6A06
Commits
74f3a739
Commit
74f3a739
authored
9 months ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
Edition module: fix regression (app_critiques)
parent
30f28888
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/formations/edit_module.py
+10
-9
10 additions, 9 deletions
app/formations/edit_module.py
app/models/modules.py
+23
-1
23 additions, 1 deletion
app/models/modules.py
with
33 additions
and
10 deletions
app/formations/edit_module.py
+
10
−
9
View file @
74f3a739
...
@@ -720,14 +720,21 @@ def module_edit(
...
@@ -720,14 +720,21 @@ def module_edit(
raise
ScoValueError
(
raise
ScoValueError
(
"
Module utilisé: il ne peut pas être changé de semestre !
"
"
Module utilisé: il ne peut pas être changé de semestre !
"
)
)
# En APC, force le semestre égal à celui de l'UE
if
not
tf
[
2
].
get
(
"
code
"
):
raise
ScoValueError
(
"
Le code du module doit être spécifié.
"
)
if
is_apc
:
if
is_apc
:
# En APC, force le semestre égal à celui de l'UE
selected_ue
=
db
.
session
.
get
(
UniteEns
,
tf
[
2
][
"
ue_id
"
])
selected_ue
=
db
.
session
.
get
(
UniteEns
,
tf
[
2
][
"
ue_id
"
])
if
selected_ue
is
None
:
if
selected_ue
is
None
:
raise
ValueError
(
"
UE invalide
"
)
raise
ValueError
(
"
UE invalide
"
)
tf
[
2
][
"
semestre_id
"
]
=
selected_ue
.
semestre_idx
tf
[
2
][
"
semestre_id
"
]
=
selected_ue
.
semestre_idx
if
not
tf
[
2
].
get
(
"
code
"
):
# Et vérifie que les AC sont bien dans ce ref. comp.
raise
ScoValueError
(
"
Le code du module doit être spécifié.
"
)
if
"
app_critiques
"
in
tf
[
2
]:
tf
[
2
][
"
app_critiques
"
]
=
Module
.
convert_app_critiques
(
tf
[
2
][
"
app_critiques
"
],
formation
.
referentiel_competence
)
# Check unicité code module dans la formation
# Check unicité code module dans la formation
# ??? TODO
# ??? TODO
#
#
...
@@ -741,12 +748,6 @@ def module_edit(
...
@@ -741,12 +748,6 @@ def module_edit(
db
.
session
.
get
(
ApcParcours
,
int
(
parcour_id_str
))
db
.
session
.
get
(
ApcParcours
,
int
(
parcour_id_str
))
for
parcour_id_str
in
form_parcours
for
parcour_id_str
in
form_parcours
]
]
# Modifie les AC
if
"
app_critiques
"
in
tf
[
2
]:
module
.
app_critiques
=
[
db
.
session
.
get
(
ApcAppCritique
,
int
(
ac_id_str
))
for
ac_id_str
in
tf
[
2
][
"
app_critiques
"
]
]
db
.
session
.
add
(
module
)
db
.
session
.
add
(
module
)
db
.
session
.
commit
()
db
.
session
.
commit
()
module
.
formation
.
invalidate_cached_sems
()
module
.
formation
.
invalidate_cached_sems
()
...
...
This diff is collapsed.
Click to expand it.
app/models/modules.py
+
23
−
1
View file @
74f3a739
...
@@ -8,6 +8,7 @@ from app import db, log
...
@@ -8,6 +8,7 @@ from app import db, log
from
app
import
models
from
app
import
models
from
app.models
import
APO_CODE_STR_LEN
from
app.models
import
APO_CODE_STR_LEN
from
app.models.but_refcomp
import
(
from
app.models.but_refcomp
import
(
ApcAppCritique
,
ApcParcours
,
ApcParcours
,
ApcReferentielCompetences
,
ApcReferentielCompetences
,
app_critiques_modules
,
app_critiques_modules
,
...
@@ -110,9 +111,30 @@ class Module(models.ScoDocModel):
...
@@ -110,9 +111,30 @@ class Module(models.ScoDocModel):
if
key
in
fs_empty_stored_as_nulls
and
value
==
""
:
if
key
in
fs_empty_stored_as_nulls
and
value
==
""
:
value
=
None
value
=
None
args_dict
[
key
]
=
value
args_dict
[
key
]
=
value
if
key
==
"
app_critiques
"
:
# peut être liste d'ApcAppCritique ou d'ids
args_dict
[
key
]
=
cls
.
convert_app_critiques
(
value
)
return
args_dict
return
args_dict
@staticmethod
def
convert_app_critiques
(
app_crits
:
list
,
ref_comp
:
ApcReferentielCompetences
|
None
=
None
)
->
list
[
ApcAppCritique
]:
"""
"""
res
=
[]
for
x
in
app_crits
:
app_crit
=
(
x
if
isinstance
(
x
,
ApcAppCritique
)
else
db
.
session
.
get
(
ApcAppCritique
,
x
)
)
if
app_crit
is
None
:
raise
ScoValueError
(
"
app_critiques invalid
"
)
if
ref_comp
and
app_crit
.
niveau
.
competence
.
referentiel_id
!=
ref_comp
.
id
:
raise
ScoValueError
(
"
app_critique hors référentiel !
"
)
res
.
append
(
app_crit
)
return
res
@classmethod
@classmethod
def
filter_model_attributes
(
cls
,
args
:
dict
,
excluded
:
set
[
str
]
=
None
)
->
dict
:
def
filter_model_attributes
(
cls
,
args
:
dict
,
excluded
:
set
[
str
]
=
None
)
->
dict
:
"""
Returns a copy of dict with only the keys belonging to the Model and not in excluded.
"""
Returns a copy of dict with only the keys belonging to the Model and not in excluded.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment