Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
5cc7eff9
Commit
5cc7eff9
authored
Oct 24, 2019
by
tleb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pedagogy: uv autofill finishing touches
parent
1c0d15ba
Pipeline
#2124
passed with stage
in 38 minutes and 39 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
14 deletions
+26
-14
api/views/uv.py
api/views/uv.py
+17
-10
core/static/core/js/script.js
core/static/core/js/script.js
+7
-0
pedagogy/templates/pedagogy/uv_edit.jinja
pedagogy/templates/pedagogy/uv_edit.jinja
+1
-0
sith/settings.py
sith/settings.py
+1
-4
No files found.
api/views/uv.py
View file @
5cc7eff9
...
...
@@ -35,8 +35,8 @@ def find_uv(lang, year, code):
full_uv is the detailed representation of an UV.
"""
# query the UV list
uvs_url
=
settings
.
SITH_PEDAGOGY_UTBM_API
_UVS_URL
response
=
urllib
.
request
.
urlopen
(
uvs_url
.
format
(
lang
=
lang
,
year
=
year
)
)
uvs_url
=
settings
.
SITH_PEDAGOGY_UTBM_API
+
"/uvs/{}/{}"
.
format
(
lang
,
year
)
response
=
urllib
.
request
.
urlopen
(
uvs_url
)
uvs
=
json
.
loads
(
response
.
read
().
decode
(
"utf-8"
))
try
:
...
...
@@ -46,11 +46,10 @@ def find_uv(lang, year, code):
return
(
None
,
None
)
# get detailed information about the UV
response
=
urllib
.
request
.
urlopen
(
settings
.
SITH_PEDAGOGY_UTBM_API_UV_URL
.
format
(
lang
=
lang
,
year
=
year
,
code
=
code
,
formation
=
short_uv
[
"codeFormation"
]
)
uv_url
=
settings
.
SITH_PEDAGOGY_UTBM_API
+
"/uv/{}/{}/{}/{}"
.
format
(
lang
,
year
,
code
,
short_uv
[
"codeFormation"
]
)
response
=
urllib
.
request
.
urlopen
(
uv_url
)
full_uv
=
json
.
loads
(
response
.
read
().
decode
(
"utf-8"
))
return
(
short_uv
,
full_uv
)
...
...
@@ -112,9 +111,17 @@ def make_clean_uv(short_uv, full_uv):
res
[
"title"
]
=
full_uv
[
"libelle"
]
res
[
"objectives"
]
=
full_uv
[
"objectifs"
]
res
[
"program"
]
=
full_uv
[
"programme"
]
res
[
"skills"
]
=
full_uv
[
"acquisitionCompetences"
]
res
[
"key_concepts"
]
=
full_uv
[
"acquisitionNotions"
]
descriptions
=
{
"objectives"
:
"objectifs"
,
"program"
:
"programme"
,
"skills"
:
"acquisitionCompetences"
,
"key_concepts"
:
"acquisitionNotions"
,
}
for
res_key
,
full_uv_key
in
descriptions
.
items
():
res
[
res_key
]
=
full_uv
[
full_uv_key
]
# if not found or the API did not return a string
if
type
(
res
[
res_key
])
!=
str
:
res
[
res_key
]
=
""
return
res
core/static/core/js/script.js
View file @
5cc7eff9
...
...
@@ -47,6 +47,13 @@ function createQuickNotif(msg) {
document
.
getElementById
(
'
quick_notif
'
).
appendChild
(
el
)
}
function
deleteQuickNotifs
()
{
const
el
=
document
.
getElementById
(
'
quick_notif
'
)
while
(
el
.
firstChild
)
{
el
.
removeChild
(
el
.
firstChild
)
}
}
function
display_notif
()
{
$
(
'
#header_notif
'
).
toggle
().
parent
().
toggleClass
(
"
white
"
);
}
...
...
pedagogy/templates/pedagogy/uv_edit.jinja
View file @
5cc7eff9
...
...
@@ -52,6 +52,7 @@
year
--
}
const
url
=
"
{{
url
(
'api:uv_endpoint'
)
}}
?year=
"
+
year
+
"
&code=
"
+
codeInput
.
value
deleteQuickNotifs
()
$
.
ajax
({
dataType
:
"
json
"
,
...
...
sith/settings.py
View file @
5cc7eff9
...
...
@@ -445,10 +445,7 @@ SITH_PEDAGOGY_UV_RESULT_GRADE = [
(
"ABS"
,
_
(
"Abs"
)),
]
base_url
=
"https://extranet1.utbm.fr/gpedago/api/guide"
SITH_PEDAGOGY_UTBM_API_UVS_URL
=
base_url
+
"/uvs/{lang}/{year}"
SITH_PEDAGOGY_UTBM_API_UV_URL
=
base_url
+
"/uv/{lang}/{year}/{code}/{formation}"
del
base_url
SITH_PEDAGOGY_UTBM_API
=
"https://extranet1.utbm.fr/gpedago/api/guide"
SITH_ECOCUP_CONS
=
1152
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment