forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
15
scodoc.py
15
scodoc.py
@ -660,7 +660,12 @@ def profile(host, port, length, profile_dir):
|
|||||||
@click.option(
|
@click.option(
|
||||||
"-n",
|
"-n",
|
||||||
"--noon",
|
"--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(
|
@click.option(
|
||||||
"-e",
|
"-e",
|
||||||
@ -669,10 +674,14 @@ def profile(host, port, length, profile_dir):
|
|||||||
)
|
)
|
||||||
@with_appcontext
|
@with_appcontext
|
||||||
def migrate_abs_to_assiduites(
|
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
|
): # migrate-abs-to-assiduites
|
||||||
"""Permet de migrer les absences vers le nouveau module d'assiduités"""
|
"""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
|
# import cProfile
|
||||||
# cProfile.runctx(
|
# cProfile.runctx(
|
||||||
# f"tools.migrate_abs_to_assiduites({dept})",
|
# f"tools.migrate_abs_to_assiduites({dept})",
|
||||||
|
@ -47,6 +47,7 @@ class _glob:
|
|||||||
|
|
||||||
MORNING: time = None
|
MORNING: time = None
|
||||||
NOON: time = None
|
NOON: time = None
|
||||||
|
AFTERNOON: time = None
|
||||||
EVENING: time = None
|
EVENING: time = None
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ class _Merger:
|
|||||||
time_ = _glob.NOON if end else _glob.MORNING
|
time_ = _glob.NOON if end else _glob.MORNING
|
||||||
date_ = datetime.combine(couple[0], time_)
|
date_ = datetime.combine(couple[0], time_)
|
||||||
else:
|
else:
|
||||||
time_ = _glob.EVENING if end else _glob.NOON
|
time_ = _glob.EVENING if end else _glob.AFTERNOON
|
||||||
date_ = datetime.combine(couple[0], time_)
|
date_ = datetime.combine(couple[0], time_)
|
||||||
d = localize_datetime(date_)
|
d = localize_datetime(date_)
|
||||||
return d
|
return d
|
||||||
@ -229,6 +230,7 @@ def migrate_abs_to_assiduites(
|
|||||||
dept: str = None,
|
dept: str = None,
|
||||||
morning: str = None,
|
morning: str = None,
|
||||||
noon: str = None,
|
noon: str = None,
|
||||||
|
afternoon: str = None,
|
||||||
evening: str = None,
|
evening: str = None,
|
||||||
debug: bool = False,
|
debug: bool = False,
|
||||||
):
|
):
|
||||||
@ -266,6 +268,12 @@ def migrate_abs_to_assiduites(
|
|||||||
noon: list[str] = str(noon).split(":")
|
noon: list[str] = str(noon).split(":")
|
||||||
_glob.NOON = time(int(noon[0]), int(noon[1]))
|
_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:
|
if evening is None:
|
||||||
evening = ScoDocSiteConfig.get("assi_afternoon_time", time(18, 0))
|
evening = ScoDocSiteConfig.get("assi_afternoon_time", time(18, 0))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user