Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scodoc_issue_976
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
Louis Dormael
scodoc_issue_976
Commits
18d63244
Commit
18d63244
authored
3 years ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
ré-écriture ue_sharing_code avec SQLAlchemy
parent
ce31d314
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+3
-7
3 additions, 7 deletions
README.md
app/models/departements.py
+3
-0
3 additions, 0 deletions
app/models/departements.py
app/models/formations.py
+7
-0
7 additions, 0 deletions
app/models/formations.py
app/scodoc/sco_edit_ue.py
+22
-24
22 additions, 24 deletions
app/scodoc/sco_edit_ue.py
with
35 additions
and
31 deletions
README.md
+
3
−
7
View file @
18d63244
...
...
@@ -3,16 +3,12 @@
(c) Emmanuel Viennet 1999 - 2021 (voir LICENCE.txt)
VERSION EXPERIMENTALE - NE PAS DEPLOYER - TESTS EN COURS
Installation: voir instructions à jour sur
<https://scodoc.org/GuideInstallDebian11>
Documentation utilisateur:
<https://scodoc.org>
## Version ScoDoc 9
N'utiliser que pour les développements et tests.
La version ScoDoc 9 est basée sur Flask (au lieu de Zope) et sur
**python 3.9+**
.
...
...
@@ -22,13 +18,13 @@ Flask, SQLAlchemy, au lien de Python2/Zope dans les versions précédentes).
### État actuel (2
7 aoû
t 21)
### État actuel (2
6 sep
t 21)
-
Tests en cours, notamment système d'installation et de migration.
-
9.0 reproduit l'ensemble des fonctions de ScoDoc 7 (donc pas de BUT), sauf:
**Fonctionnalités non intégrées:**
-
feuille "placement" (en cours)
-
génération LaTeX des avis de poursuite d'études
-
ancien module "Entreprises" (obsolete)
...
...
This diff is collapsed.
Click to expand it.
app/models/departements.py
+
3
−
0
View file @
18d63244
...
...
@@ -44,3 +44,6 @@ class Departement(db.Model):
"
date_creation
"
:
self
.
date_creation
,
}
return
data
def
__repr__
(
self
):
return
f
"
<
{
self
.
__class__
.
__name__
}
(id=
{
self
.
id
}
, acronym=
'
{
self
.
acronym
}
'
)>
"
This diff is collapsed.
Click to expand it.
app/models/formations.py
+
7
−
0
View file @
18d63244
...
...
@@ -30,8 +30,12 @@ class NotesFormation(db.Model):
type_parcours
=
db
.
Column
(
db
.
Integer
,
default
=
0
,
server_default
=
"
0
"
)
code_specialite
=
db
.
Column
(
db
.
String
(
SHORT_STR_LEN
))
ues
=
db
.
relationship
(
"
NotesUE
"
,
backref
=
"
formation
"
,
lazy
=
"
dynamic
"
)
formsemestres
=
db
.
relationship
(
"
FormSemestre
"
,
lazy
=
"
dynamic
"
,
backref
=
"
formation
"
)
def
__repr__
(
self
):
return
f
"
<
{
self
.
__class__
.
__name__
}
(id=
{
self
.
id
}
, dept_id=
{
self
.
dept_id
}
, acronyme=
'
{
self
.
acronyme
}
'
)>
"
class
NotesUE
(
db
.
Model
):
"""
Unité d
'
Enseignement
"""
...
...
@@ -61,6 +65,9 @@ class NotesUE(db.Model):
# coef UE, utilise seulement si l'option use_ue_coefs est activée:
coefficient
=
db
.
Column
(
db
.
Float
)
def
__repr__
(
self
):
return
f
"
<
{
self
.
__class__
.
__name__
}
(id=
{
self
.
id
}
, formation_id=
{
self
.
formation_id
}
, acronyme=
'
{
self
.
acronyme
}
'
)>
"
class
NotesMatiere
(
db
.
Model
):
"""
Matières: regroupe les modules d
'
une UE
...
...
This diff is collapsed.
Click to expand it.
app/scodoc/sco_edit_ue.py
+
22
−
24
View file @
18d63244
...
...
@@ -32,6 +32,7 @@ import flask
from
flask
import
g
,
url_for
,
request
from
flask_login
import
current_user
from
app.models.formations
import
NotesUE
import
app.scodoc.notesdb
as
ndb
import
app.scodoc.sco_utils
as
scu
from
app
import
log
...
...
@@ -851,24 +852,26 @@ def ue_sharing_code(ue_code=None, ue_id=None, hide_ue_id=None):
F
=
sco_formations
.
formation_list
(
args
=
{
"
formation_id
"
:
ue
[
"
formation_id
"
]})[
0
]
formation_code
=
F
[
"
formation_code
"
]
ue_list_all
=
do_ue_list
(
args
=
{
"
ue_code
"
:
ue_code
})
if
ue_id
:
# retire les UE d'autres formations:
# log('checking ucode %s formation %s' % (ue_code, formation_code))
ue_list
=
[]
for
ue
in
ue_list_all
:
F
=
sco_formations
.
formation_list
(
args
=
{
"
formation_id
"
:
ue
[
"
formation_id
"
]}
)[
0
]
if
formation_code
==
F
[
"
formation_code
"
]:
ue_list
.
append
(
ue
)
# UE du même code, code formation et departement
q_ues
=
(
NotesUE
.
query
.
filter_by
(
ue_code
=
ue_code
)
.
join
(
NotesUE
.
formation
,
aliased
=
True
)
.
filter_by
(
dept_id
=
F
[
"
dept_id
"
],
formation_code
=
formation_code
)
)
else
:
ue_list
=
ue_list_all
# Toutes les UE du departement avec ce code
q_ues
=
(
NotesUE
.
query
.
filter_by
(
ue_code
=
ue_code
)
.
join
(
NotesUE
.
formation
,
aliased
=
True
)
.
filter_by
(
dept_id
=
F
[
"
dept_id
"
])
)
if
hide_ue_id
:
# enlève l'ue de depart
ue_list
=
[
ue
for
ue
in
ue_list
if
ue
[
"
ue_id
"
]
!=
hide_ue_id
]
q_ues
=
q_ues
.
filter
(
NotesUE
.
id
!=
hide_ue_id
)
if
not
ue_list
:
ues
=
q_ues
.
all
()
if
not
ues
:
if
ue_id
:
return
"""
<span class=
"
ue_share
"
>Seule UE avec code %s</span>
"""
%
ue_code
else
:
...
...
@@ -879,18 +882,13 @@ def ue_sharing_code(ue_code=None, ue_id=None, hide_ue_id=None):
else
:
H
.
append
(
'
<span class=
"
ue_share
"
>UE avec le code %s:</span>
'
%
ue_code
)
H
.
append
(
"
<ul>
"
)
for
ue
in
ue_list
:
F
=
sco_formations
.
formation_list
(
args
=
{
"
formation_id
"
:
ue
[
"
formation_id
"
]})[
0
]
for
ue
in
ues
:
H
.
append
(
'
<li>%s (%s) dans <a class=
"
stdlink
"
href=
"
ue_list?formation_id=%s
"
>%s (%s)</a>, version %s</li>
'
%
(
ue
[
"
acronyme
"
],
ue
[
"
titre
"
],
F
[
"
formation_id
"
],
F
[
"
acronyme
"
],
F
[
"
titre
"
],
F
[
"
version
"
],
)
f
"""
<li>
{
ue
.
acronyme
}
(
{
ue
.
titre
}
) dans <a class=
"
stdlink
"
href=
"
{
url_for
(
"
notes.ue_list
"
,
scodoc_dept
=
g
.
scodoc_dept
,
formation_id
=
ue
.
formation
.
id
)
}
"
>
{
ue
.
formation
.
acronyme
}
(
{
ue
.
formation
.
titre
}
)</a>, version
{
ue
.
formation
.
version
}
</li>
"""
)
H
.
append
(
"
</ul>
"
)
return
"
\n
"
.
join
(
H
)
...
...
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