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
ece689eb
Commit
ece689eb
authored
1 year ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
API: moduleimpl-notes
parent
242771c6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/api/evaluations.py
+3
-9
3 additions, 9 deletions
app/api/evaluations.py
app/api/moduleimpl.py
+36
-13
36 additions, 13 deletions
app/api/moduleimpl.py
app/scodoc/sco_liste_notes.py
+6
-5
6 additions, 5 deletions
app/scodoc/sco_liste_notes.py
app/views/notes.py
+3
-1
3 additions, 1 deletion
app/views/notes.py
with
48 additions
and
28 deletions
app/api/evaluations.py
+
3
−
9
View file @
ece689eb
...
@@ -67,7 +67,7 @@ def get_evaluation(evaluation_id: int):
...
@@ -67,7 +67,7 @@ def get_evaluation(evaluation_id: int):
@scodoc
@scodoc
@permission_required
(
Permission
.
ScoView
)
@permission_required
(
Permission
.
ScoView
)
@as_json
@as_json
def
evaluations
(
moduleimpl_id
:
int
):
def
moduleimpl_
evaluations
(
moduleimpl_id
:
int
):
"""
"""
Retourne la liste des évaluations d
'
un moduleimpl
Retourne la liste des évaluations d
'
un moduleimpl
...
@@ -75,14 +75,8 @@ def evaluations(moduleimpl_id: int):
...
@@ -75,14 +75,8 @@ def evaluations(moduleimpl_id: int):
Exemple de résultat : voir /evaluation
Exemple de résultat : voir /evaluation
"""
"""
query
=
Evaluation
.
query
.
filter_by
(
moduleimpl_id
=
moduleimpl_id
)
modimpl
=
ModuleImpl
.
get_modimpl
(
moduleimpl_id
)
if
g
.
scodoc_dept
:
return
[
evaluation
.
to_dict_api
()
for
evaluation
in
modimpl
.
evaluations
]
query
=
(
query
.
join
(
ModuleImpl
)
.
join
(
FormSemestre
)
.
filter_by
(
dept_id
=
g
.
scodoc_dept_id
)
)
return
[
e
.
to_dict_api
()
for
e
in
query
]
@bp.route
(
"
/evaluation/<int:evaluation_id>/notes
"
)
@bp.route
(
"
/evaluation/<int:evaluation_id>/notes
"
)
...
...
This diff is collapsed.
Click to expand it.
app/api/moduleimpl.py
+
36
−
13
View file @
ece689eb
...
@@ -8,16 +8,14 @@
...
@@ -8,16 +8,14 @@
ScoDoc 9 API : accès aux moduleimpl
ScoDoc 9 API : accès aux moduleimpl
"""
"""
from
flask
import
g
from
flask_json
import
as_json
from
flask_json
import
as_json
from
flask_login
import
login_required
from
flask_login
import
login_required
import
app
from
app.api
import
api_bp
as
bp
,
api_web_bp
from
app.api
import
api_bp
as
bp
,
api_web_bp
from
app.decorators
import
scodoc
,
permission_required
from
app.decorators
import
scodoc
,
permission_required
from
app.models
import
(
from
app.models
import
ModuleImpl
FormSemestre
,
from
app.scodoc
import
sco_liste_notes
ModuleImpl
,
)
from
app.scodoc.sco_permissions
import
Permission
from
app.scodoc.sco_permissions
import
Permission
...
@@ -62,10 +60,7 @@ def moduleimpl(moduleimpl_id: int):
...
@@ -62,10 +60,7 @@ def moduleimpl(moduleimpl_id: int):
}
}
}
}
"""
"""
query
=
ModuleImpl
.
query
.
filter_by
(
id
=
moduleimpl_id
)
modimpl
=
ModuleImpl
.
get_modimpl
(
moduleimpl_id
)
if
g
.
scodoc_dept
:
query
=
query
.
join
(
FormSemestre
).
filter_by
(
dept_id
=
g
.
scodoc_dept_id
)
modimpl
:
ModuleImpl
=
query
.
first_or_404
()
return
modimpl
.
to_dict
(
convert_objects
=
True
)
return
modimpl
.
to_dict
(
convert_objects
=
True
)
...
@@ -87,8 +82,36 @@ def moduleimpl_inscriptions(moduleimpl_id: int):
...
@@ -87,8 +82,36 @@ def moduleimpl_inscriptions(moduleimpl_id: int):
...
...
]
]
"""
"""
query
=
ModuleImpl
.
query
.
filter_by
(
id
=
moduleimpl_id
)
modimpl
=
ModuleImpl
.
get_modimpl
(
moduleimpl_id
)
if
g
.
scodoc_dept
:
query
=
query
.
join
(
FormSemestre
).
filter_by
(
dept_id
=
g
.
scodoc_dept_id
)
modimpl
:
ModuleImpl
=
query
.
first_or_404
()
return
[
i
.
to_dict
()
for
i
in
modimpl
.
inscriptions
]
return
[
i
.
to_dict
()
for
i
in
modimpl
.
inscriptions
]
@bp.route
(
"
/moduleimpl/<int:moduleimpl_id>/notes
"
)
@api_web_bp.route
(
"
/moduleimpl/<int:moduleimpl_id>/notes
"
)
@login_required
@scodoc
@permission_required
(
Permission
.
ScoView
)
def
moduleimpl_notes
(
moduleimpl_id
:
int
):
"""
Liste des notes dans ce moduleimpl
Exemple de résultat :
[
{
"
etudid
"
: 17776, // code de l
'
étudiant
"
nom
"
:
"
DUPONT
"
,
"
prenom
"
:
"
Luz
"
,
"
38411
"
: 16.0, // Note dans l
'
évaluation d
'
id 38411
"
38410
"
: 15.0,
"
moymod
"
: 15.5, // Moyenne INDICATIVE module
"
moy_ue_2875
"
: 15.5, // Moyenne vers l
'
UE 2875
"
moy_ue_2876
"
: 15.5, // Moyenne vers l
'
UE 2876
"
moy_ue_2877
"
: 15.5 // Moyenne vers l
'
UE 2877
},
...
]
"""
modimpl
=
ModuleImpl
.
get_modimpl
(
moduleimpl_id
)
app
.
set_sco_dept
(
modimpl
.
formsemestre
.
departement
.
acronym
)
table
,
_
=
sco_liste_notes
.
do_evaluation_listenotes
(
moduleimpl_id
=
modimpl
.
id
,
fmt
=
"
json
"
)
return
table
This diff is collapsed.
Click to expand it.
app/scodoc/sco_liste_notes.py
+
6
−
5
View file @
ece689eb
...
@@ -264,7 +264,7 @@ def _make_table_notes(
...
@@ -264,7 +264,7 @@ def _make_table_notes(
if
e
.
moduleimpl_id
!=
modimpl
.
id
:
if
e
.
moduleimpl_id
!=
modimpl
.
id
:
raise
ValueError
(
"
invalid evaluations list
"
)
raise
ValueError
(
"
invalid evaluations list
"
)
if
fmt
==
"
xls
"
:
if
fmt
==
"
xls
"
or
fmt
==
"
json
"
:
keep_numeric
=
True
# pas de conversion des notes en strings
keep_numeric
=
True
# pas de conversion des notes en strings
else
:
else
:
keep_numeric
=
False
keep_numeric
=
False
...
@@ -279,11 +279,12 @@ def _make_table_notes(
...
@@ -279,11 +279,12 @@ def _make_table_notes(
if
anonymous_listing
:
if
anonymous_listing
:
columns_ids
=
[
"
code
"
]
# cols in table
columns_ids
=
[
"
code
"
]
# cols in table
else
:
else
:
if
fmt
==
"
xls
"
or
fmt
==
"
xml
"
:
if
fmt
in
{
"
xls
"
,
"
xml
"
,
"
json
"
}
:
columns_ids
=
[
"
nom
"
,
"
prenom
"
]
columns_ids
=
[
"
etudid
"
,
"
nom
"
,
"
prenom
"
]
else
:
else
:
columns_ids
=
[
"
nomprenom
"
]
columns_ids
=
[
"
nomprenom
"
]
if
not
hide_groups
:
if
not
hide_groups
and
fmt
not
in
{
"
xls
"
,
"
xml
"
,
"
json
"
}:
# n'indique pas les groupes en xls, json car notation "humaine" ici
columns_ids
.
append
(
"
group
"
)
columns_ids
.
append
(
"
group
"
)
titles
=
{
titles
=
{
...
@@ -476,7 +477,7 @@ def _make_table_notes(
...
@@ -476,7 +477,7 @@ def _make_table_notes(
if
with_emails
:
if
with_emails
:
columns_ids
+=
[
"
email
"
,
"
emailperso
"
]
columns_ids
+=
[
"
email
"
,
"
emailperso
"
]
# Ajoute lignes en tête et moyennes
# Ajoute lignes en tête et moyennes
if
len
(
evaluations
)
>
0
and
fmt
!=
"
bordereau
"
:
if
len
(
evaluations
)
>
0
and
fmt
!=
"
bordereau
"
and
fmt
!=
"
json
"
:
rows_head
=
[
row_coefs
]
rows_head
=
[
row_coefs
]
if
is_apc
:
if
is_apc
:
rows_head
.
append
(
row_poids
)
rows_head
.
append
(
row_poids
)
...
...
This diff is collapsed.
Click to expand it.
app/views/notes.py
+
3
−
1
View file @
ece689eb
...
@@ -1761,7 +1761,9 @@ def evaluation_create(moduleimpl_id):
...
@@ -1761,7 +1761,9 @@ def evaluation_create(moduleimpl_id):
@permission_required_compat_scodoc7
(
Permission
.
ScoView
)
@permission_required_compat_scodoc7
(
Permission
.
ScoView
)
@scodoc7func
@scodoc7func
def
evaluation_listenotes
():
def
evaluation_listenotes
():
"""
Affichage des notes d
'
une évaluation
"""
"""
Affichage des notes d
'
une évaluation.
Si evaluation_id non spécifié, toutes les notes des évaluations de ce modimpl.
"""
evaluation_id
=
None
evaluation_id
=
None
moduleimpl_id
=
None
moduleimpl_id
=
None
vals
=
scu
.
get_request_args
()
vals
=
scu
.
get_request_args
()
...
...
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