mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
pedagogy: uv autofill finishing touches
This commit is contained in:
parent
1c0d15ba2a
commit
5cc7eff94f
@ -35,8 +35,8 @@ def find_uv(lang, year, code):
|
|||||||
full_uv is the detailed representation of an UV.
|
full_uv is the detailed representation of an UV.
|
||||||
"""
|
"""
|
||||||
# query the UV list
|
# query the UV list
|
||||||
uvs_url = settings.SITH_PEDAGOGY_UTBM_API_UVS_URL
|
uvs_url = settings.SITH_PEDAGOGY_UTBM_API + "/uvs/{}/{}".format(lang, year)
|
||||||
response = urllib.request.urlopen(uvs_url.format(lang=lang, year=year))
|
response = urllib.request.urlopen(uvs_url)
|
||||||
uvs = json.loads(response.read().decode("utf-8"))
|
uvs = json.loads(response.read().decode("utf-8"))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -46,11 +46,10 @@ def find_uv(lang, year, code):
|
|||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
# get detailed information about the UV
|
# get detailed information about the UV
|
||||||
response = urllib.request.urlopen(
|
uv_url = settings.SITH_PEDAGOGY_UTBM_API + "/uv/{}/{}/{}/{}".format(
|
||||||
settings.SITH_PEDAGOGY_UTBM_API_UV_URL.format(
|
lang, year, code, short_uv["codeFormation"]
|
||||||
lang=lang, year=year, code=code, formation=short_uv["codeFormation"]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
response = urllib.request.urlopen(uv_url)
|
||||||
full_uv = json.loads(response.read().decode("utf-8"))
|
full_uv = json.loads(response.read().decode("utf-8"))
|
||||||
|
|
||||||
return (short_uv, full_uv)
|
return (short_uv, full_uv)
|
||||||
@ -112,9 +111,17 @@ def make_clean_uv(short_uv, full_uv):
|
|||||||
|
|
||||||
res["title"] = full_uv["libelle"]
|
res["title"] = full_uv["libelle"]
|
||||||
|
|
||||||
res["objectives"] = full_uv["objectifs"]
|
descriptions = {
|
||||||
res["program"] = full_uv["programme"]
|
"objectives": "objectifs",
|
||||||
res["skills"] = full_uv["acquisitionCompetences"]
|
"program": "programme",
|
||||||
res["key_concepts"] = full_uv["acquisitionNotions"]
|
"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
|
return res
|
||||||
|
@ -47,6 +47,13 @@ function createQuickNotif(msg) {
|
|||||||
document.getElementById('quick_notif').appendChild(el)
|
document.getElementById('quick_notif').appendChild(el)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteQuickNotifs() {
|
||||||
|
const el = document.getElementById('quick_notif')
|
||||||
|
while (el.firstChild) {
|
||||||
|
el.removeChild(el.firstChild)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function display_notif() {
|
function display_notif() {
|
||||||
$('#header_notif').toggle().parent().toggleClass("white");
|
$('#header_notif').toggle().parent().toggleClass("white");
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
year--
|
year--
|
||||||
}
|
}
|
||||||
const url = "{{ url('api:uv_endpoint') }}?year=" + year + "&code=" + codeInput.value
|
const url = "{{ url('api:uv_endpoint') }}?year=" + year + "&code=" + codeInput.value
|
||||||
|
deleteQuickNotifs()
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
@ -445,10 +445,7 @@ SITH_PEDAGOGY_UV_RESULT_GRADE = [
|
|||||||
("ABS", _("Abs")),
|
("ABS", _("Abs")),
|
||||||
]
|
]
|
||||||
|
|
||||||
base_url = "https://extranet1.utbm.fr/gpedago/api/guide"
|
SITH_PEDAGOGY_UTBM_API = "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_ECOCUP_CONS = 1152
|
SITH_ECOCUP_CONS = 1152
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user