Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
Showing only changes of commit 4b4e52bf2d - Show all commits

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,