1
0
forked from ScoDoc/ScoDoc

Assiduites : Correction bug granularité timeline

This commit is contained in:
iziram 2023-06-02 17:40:46 +02:00
parent d2a17ffdfb
commit 4b4e52bf2d

View File

@ -203,8 +203,15 @@ def config_assiduites():
flash("Heure de midi enregistrée")
if ScoDocSiteConfig.set("assi_afternoon_time", form.data["afternoon_time"]):
flash("Heure de fin de la journée enregistrée")
if ScoDocSiteConfig.set("assi_tick_time", form.data["tick_time"]):
if (
form.data["tick_time"] > 0
and form.data["tick_time"] < 60
and ScoDocSiteConfig.set("assi_tick_time", float(form.data["tick_time"]))
):
flash("Granularité de la timeline enregistrée")
else:
flash("Erreur : Granularité invalide ou identique")
return redirect(url_for("scodoc.configuration"))
elif request.method == "GET":
@ -217,7 +224,12 @@ def config_assiduites():
form.afternoon_time.data = ScoDocSiteConfig.get(
"assi_afternoon_time", datetime.time(18, 0, 0)
)
form.tick_time.data = float(ScoDocSiteConfig.get("assi_tick_time", 15))
try:
form.tick_time.data = float(ScoDocSiteConfig.get("assi_tick_time", 15.0))
except ValueError:
form.tick_time.data = 15.0
ScoDocSiteConfig.set("assi_tick_time", 15.0)
return render_template(
"assiduites/config_assiduites.j2",
form=form,