Ajout infos campus/horaire/ens.

This commit is contained in:
Ilona 2025-01-09 02:30:47 +01:00
parent b2d23de7b6
commit 09a4d0a79a
3 changed files with 50 additions and 17 deletions

View File

@ -18,7 +18,7 @@ div.responsable {
margin-bottom: 16px; margin-bottom: 16px;
} }
.photo-ens img { .photo-ens img {
width: 256px; height: 200px;
margin-top: 8px; margin-top: 8px;
margin-bottom: 8px; margin-bottom: 8px;
} }
@ -57,7 +57,7 @@ table.course-details td {
</div> </div>
<div class="photo-ens"> <div class="photo-ens">
<img src="{{url_for('autosco.formsemestre_get_photo_ens', formsemestre_id=sem.id)}}" <img src="{{url_for('autosco.formsemestre_get_photo_ens', formsemestre_id=sem.id)}}"
alt="Photo de {{sem.descr.responsable}}" /> alt="Photo de {{sem.descr.responsable}}"/>
</div> </div>
<table class="course-details"> <table class="course-details">
@ -104,13 +104,13 @@ table.course-details td {
</div> </div>
<div> <div style="margin-top: 16px; color: red; font-weight: bold;">
API_URL={{cfg.API_URL}} TODO: boite état inscriptions, places disponibles et lien vers formulaire d'inscription
</div> </div>
{# XXX DEVELOPMENT XXX #} {# XXX DEVELOPMENT XXX #}
<div style="background-color: #f0f0f0; padding: 10px; margin-top: 64px;"> <div style="background-color: #f0f0f0; padding: 10px; margin-top: 64px; font-size: 50%;">
<b>Informations de développement</b>
<tt> <tt>
{% for k, v in sem.items() | sort(attribute='0') %} {% for k, v in sem.items() | sort(attribute='0') %}
<div> <div>

View File

@ -32,11 +32,23 @@ div.sem.ouvert {
color: #bc76bf; color: #bc76bf;
margin-left: 12px; margin-left: 12px;
} }
div.inscription { div.inscription, div.infos-semestre {
margin-top: 8px; margin-top: 8px;
margin-left: 16px; margin-left: 16px;
font-size: 12pt; font-size: 12pt;
} }
div.infos-semestre span {
margin-right: 16px;
}
.svg-inline--fa {
display: inline-block;
height: 1em;
overflow: visible;
vertical-align: -0.125em;
}
</style> </style>
{% endblock %} {% endblock %}
@ -65,6 +77,23 @@ div.inscription {
</div> </div>
{% endif %} {% endif %}
<div class="infos-semestre">
<span class="campus">
<svg class="svg-inline--fa fa-location-dot" aria-hidden="true" focusable="false" data-prefix="fal" data-icon="location-dot" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path class="" fill="currentColor" d="M352 192c0-88.4-71.6-160-160-160S32 103.6 32 192c0 15.6 5.4 37 16.6 63.4c10.9 25.9 26.2 54 43.6 82.1c34.1 55.3 74.4 108.2 99.9 140c25.4-31.8 65.8-84.7 99.9-140c17.3-28.1 32.7-56.3 43.6-82.1C346.6 229 352 207.6 352 192zm32 0c0 87.4-117 243-168.3 307.2c-12.3 15.3-35.1 15.3-47.4 0C117 435 0 279.4 0 192C0 86 86 0 192 0S384 86 384 192zm-240 0a48 48 0 1 0 96 0 48 48 0 1 0 -96 0zm48 80a80 80 0 1 1 0-160 80 80 0 1 1 0 160z"></path></svg>
{{sem.descr.campus}}
</span>
<span class="horaire">
<svg class="svg-inline--fa fa-calendar" aria-hidden="true" focusable="false" data-prefix="fal" data-icon="calendar" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path class="" fill="currentColor" d="M112 0c8.8 0 16 7.2 16 16V64H320V16c0-8.8 7.2-16 16-16s16 7.2 16 16V64h32c35.3 0 64 28.7 64 64v32 32V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192 160 128C0 92.7 28.7 64 64 64H96V16c0-8.8 7.2-16 16-16zM416 192H32V448c0 17.7 14.3 32 32 32H384c17.7 0 32-14.3 32-32V192zM384 96H64c-17.7 0-32 14.3-32 32v32H416V128c0-17.7-14.3-32-32-32z"></path></svg>
{{sem.descr.horaire}}
</span>
<span class="responsable">
<svg class="svg-inline--fa fa-user" aria-hidden="true" focusable="false" data-prefix="fal" data-icon="user" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path class="" fill="currentColor" d="M320 128a96 96 0 1 0 -192 0 96 96 0 1 0 192 0zM96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM32 480H416c-1.2-79.7-66.2-144-146.3-144H178.3c-80 0-145 64.3-146.3 144zM0 482.3C0 383.8 79.8 304 178.3 304h91.4C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7H29.7C13.3 512 0 498.7 0 482.3z"></path></svg>
{{sem.descr.responsable}}
</span>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -64,15 +64,19 @@ class APIAccessor:
url = self.config["SCODOC_URL"] + f"/ScoDoc/{dept}/api" + path url = self.config["SCODOC_URL"] + f"/ScoDoc/{dept}/api" + path
else: else:
url = self.config["API_URL"] + path url = self.config["API_URL"] + path
try:
reply = requests.get( reply = requests.get(
url, url,
headers=self.headers if headers is None else headers, headers=self.headers if headers is None else headers,
verify=self.config["SCODOC_CHECK_CERTIFICATE"], verify=self.config["SCODOC_CHECK_CERTIFICATE"],
timeout=self.config["API_TIMEOUT"], timeout=self.config["API_TIMEOUT"],
) )
except (OSError, requests.exceptions.ConnectionError) as exc:
log("api.get: error: url={url} exc={exc}")
log("config={self.config}")
raise APIError(f"Impossible de se connecter à ScoDoc: problème de configuration?") from exc
if reply.status_code != 200: if reply.status_code != 200:
print("url", url) log("api.get: error: url={url} status={status_code}\nreply={reply.text}")
print("reply", reply.text)
try: try:
payload = reply.json() payload = reply.json()
except requests.exceptions.JSONDecodeError: except requests.exceptions.JSONDecodeError: