diff --git a/app/scodoc/notesdb.py b/app/scodoc/notesdb.py
index add7d84a58dd807c8977586fec3648060d79bb9c..a0e7ff4beabd0af780324d1a463259b24d1a5f52 100644
--- a/app/scodoc/notesdb.py
+++ b/app/scodoc/notesdb.py
@@ -514,32 +514,6 @@ def DateISOtoDMY(isodate):
return "%02d/%02d/%04d" % (day, month, year)
-def TimetoISO8601(t, null_is_empty=False) -> str:
- "convert time string to ISO 8601 (allow 16:03, 16h03, 16)"
- if isinstance(t, datetime.time):
- return t.isoformat()
- if not t and null_is_empty:
- return ""
- t = t.strip().upper().replace("H", ":")
- if t and t.count(":") == 0 and len(t) < 3:
- t = t + ":00"
- return t
-
-
-def TimefromISO8601(t) -> str:
- "convert time string from ISO 8601 to our display format"
- if not t:
- return t
- # XXX strange bug turnaround...
- try:
- t = "%s:%s" % (t.hour(), t.minute())
- # log('TimefromISO8601: converted isotime to iso !')
- except:
- pass
- fs = str(t).split(":")
- return fs[0] + "h" + fs[1] # discard seconds
-
-
def float_null_is_zero(x):
if x is None or x == "":
return 0.0
diff --git a/app/scodoc/sco_edt_cal.py b/app/scodoc/sco_edt_cal.py
index be0112042d12d627c83e789db1f269fec3ac106a..fe1477fe57964d5a3fc08ec8f582a585794ebd87 100644
--- a/app/scodoc/sco_edt_cal.py
+++ b/app/scodoc/sco_edt_cal.py
@@ -224,20 +224,19 @@ def translate_calendar(
modimpl: ModuleImpl | bool = event["modimpl"]
params = {
"scodoc_dept": g.scodoc_dept,
- "group_ids": group.id,
- "heure_deb": event["heure_deb"].replace("h", ":") if "h" in event["heure_deb"] else event["heure_deb"],
- "heure_fin": event["heure_fin"].replace("h", ":") if "h" in event["heure_fin"] else event["heure_fin"],
- "day": event["jour"]
+ "heure_deb": scu.heure_to_iso8601(event["heure_deb"]),
+ "heure_fin": scu.heure_to_iso8601(event["heure_fin"]),
+ "day": event["jour"],
}
+ if group:
+ params["group_ids"] = group.id
if modimpl:
- params["moduleimpl_id"] = modimpl.id
+ params["moduleimpl_id"] = modimpl.id
elif group:
- params["formsemestre_id"] = group.partition.formsemestre_id
+ params["formsemestre_id"] = group.partition.formsemestre_id
url_abs = (
- url_for("assiduites.signal_assiduites_group", **params)
- if group
- else None
+ url_for("assiduites.signal_assiduites_group", **params) if group else None
)
match modimpl:
case False: # EDT non configuré
diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py
index a437b3dad15340889f048fb73088aca8d1ff87d6..53d2c66cbe7e2b5de0117b5080a2f1dc61bb3c40 100644
--- a/app/scodoc/sco_utils.py
+++ b/app/scodoc/sco_utils.py
@@ -152,6 +152,18 @@ def convert_fr_date(
raise ScoValueError("Date (j/m/a) invalide")
+def heure_to_iso8601(t, null_is_empty=False) -> str:
+ "convert time string to ISO 8601 (allow 16:03, 16h03, 16)"
+ if isinstance(t, datetime.time):
+ return t.isoformat()
+ if not t and null_is_empty:
+ return ""
+ t = t.strip().upper().replace("H", ":")
+ if t and t.count(":") == 0 and len(t) < 3:
+ t = t + ":00"
+ return t
+
+
def print_progress_bar(
iteration,
total,