forked from ScoDoc/ScoDoc
Assiduites : migration heure aprem
This commit is contained in:
parent
a04403cd0e
commit
efaeeb7b5f
15
scodoc.py
15
scodoc.py
@ -660,7 +660,12 @@ def profile(host, port, length, profile_dir):
|
||||
@click.option(
|
||||
"-n",
|
||||
"--noon",
|
||||
help="Spécifie l'heure de fin du matin (et donc début de l'après-midi) format `hh:mm`",
|
||||
help="Spécifie l'heure de fin du matin format `hh:mm`",
|
||||
)
|
||||
@click.option(
|
||||
"-a",
|
||||
"--afternoon",
|
||||
help="Spécifie l'heure de début de l'après-midi format `hh:mm` valeur identique à --noon si non spécifié",
|
||||
)
|
||||
@click.option(
|
||||
"-e",
|
||||
@ -669,10 +674,14 @@ def profile(host, port, length, profile_dir):
|
||||
)
|
||||
@with_appcontext
|
||||
def migrate_abs_to_assiduites(
|
||||
dept: str = None, morning: str = None, noon: str = None, evening: str = None
|
||||
dept: str = None,
|
||||
morning: str = None,
|
||||
noon: str = None,
|
||||
afternoon: str = None,
|
||||
evening: str = None,
|
||||
): # migrate-abs-to-assiduites
|
||||
"""Permet de migrer les absences vers le nouveau module d'assiduités"""
|
||||
tools.migrate_abs_to_assiduites(dept, morning, noon, evening)
|
||||
tools.migrate_abs_to_assiduites(dept, morning, noon, afternoon, evening)
|
||||
# import cProfile
|
||||
# cProfile.runctx(
|
||||
# f"tools.migrate_abs_to_assiduites({dept})",
|
||||
|
@ -47,6 +47,7 @@ class _glob:
|
||||
|
||||
MORNING: time = None
|
||||
NOON: time = None
|
||||
AFTERNOON: time = None
|
||||
EVENING: time = None
|
||||
|
||||
|
||||
@ -93,7 +94,7 @@ class _Merger:
|
||||
time_ = _glob.NOON if end else _glob.MORNING
|
||||
date_ = datetime.combine(couple[0], time_)
|
||||
else:
|
||||
time_ = _glob.EVENING if end else _glob.NOON
|
||||
time_ = _glob.EVENING if end else _glob.AFTERNOON
|
||||
date_ = datetime.combine(couple[0], time_)
|
||||
d = localize_datetime(date_)
|
||||
return d
|
||||
@ -229,6 +230,7 @@ def migrate_abs_to_assiduites(
|
||||
dept: str = None,
|
||||
morning: str = None,
|
||||
noon: str = None,
|
||||
afternoon: str = None,
|
||||
evening: str = None,
|
||||
debug: bool = False,
|
||||
):
|
||||
@ -266,6 +268,12 @@ def migrate_abs_to_assiduites(
|
||||
noon: list[str] = str(noon).split(":")
|
||||
_glob.NOON = time(int(noon[0]), int(noon[1]))
|
||||
|
||||
if afternoon is None:
|
||||
afternoon = ScoDocSiteConfig.get("assi_lunch_time", time(13, 0))
|
||||
|
||||
afternoon: list[str] = str(afternoon).split(":")
|
||||
_glob.AFTERNOON = time(int(afternoon[0]), int(afternoon[1]))
|
||||
|
||||
if evening is None:
|
||||
evening = ScoDocSiteConfig.get("assi_afternoon_time", time(18, 0))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user