(20260217) Ready to test on prodcuction now
This commit is contained in:
+39
-39
@@ -137,7 +137,7 @@ async def yesterday_cron(
|
||||
# for the driver's resources to get freed:
|
||||
success = common.get_in_out_summary(
|
||||
cosec_creds = cosec_creds,
|
||||
from_dt = date_time.get_current_ist_date_time() - datetime.timedelta(days = 2),
|
||||
from_dt = date_time.get_current_ist_date_time() - datetime.timedelta(days = 3),
|
||||
to_dt = date_time.get_current_ist_date_time(),
|
||||
cache_file = common.PREV_DAY_IN_OUT_SUMMARY_CACHE_FILE,
|
||||
test_mode = test_mode
|
||||
@@ -196,37 +196,37 @@ async def today_cron(
|
||||
# Try the part that needs COSEC:
|
||||
try:
|
||||
|
||||
# # MUSTER-ROLL:
|
||||
#
|
||||
# # Get the Muster Roll and then wait
|
||||
# # for the driver's resources to get freed:
|
||||
# success = common.get_muster_roll(
|
||||
# cosec_creds = cosec_creds,
|
||||
# on_date = date_time.get_current_ist_date_time().replace(
|
||||
# hour = 0,
|
||||
# minute = 0,
|
||||
# second = 0
|
||||
# ),
|
||||
# cache_file = common.PREV_DAY_IN_OUT_SUMMARY_CACHE_FILE,
|
||||
# test_mode = test_mode
|
||||
# )
|
||||
#
|
||||
# # Sync data between Cosec and TCAOFF:
|
||||
# if success:
|
||||
# print("MUSTER ROLL: Sync'ing with TCAOFF")
|
||||
# cosec_muster_roll = json.from_file(common.MUSTER_ROLL_CACHE_FILE)
|
||||
# await common.sync_branches_to_tcaoff(
|
||||
# tcaoff_client = tcaoff_client,
|
||||
# cosec_muster_roll = cosec_muster_roll,
|
||||
# )
|
||||
# await common.sync_departments_to_tcaoff(
|
||||
# tcaoff_client = tcaoff_client,
|
||||
# cosec_muster_roll = cosec_muster_roll,
|
||||
# )
|
||||
# await common.sync_teams_to_tcaoff(
|
||||
# tcaoff_client = tcaoff_client,
|
||||
# cosec_muster_roll = cosec_muster_roll,
|
||||
# )
|
||||
# MUSTER-ROLL:
|
||||
|
||||
# Get the Muster Roll and then wait
|
||||
# for the driver's resources to get freed:
|
||||
success = common.get_muster_roll(
|
||||
cosec_creds = cosec_creds,
|
||||
on_date = date_time.get_current_ist_date_time().replace(
|
||||
hour = 0,
|
||||
minute = 0,
|
||||
second = 0
|
||||
),
|
||||
cache_file = common.PREV_DAY_IN_OUT_SUMMARY_CACHE_FILE,
|
||||
test_mode = test_mode
|
||||
)
|
||||
|
||||
# Sync data between Cosec and TCAOFF:
|
||||
if success:
|
||||
print("MUSTER ROLL: Sync'ing with TCAOFF")
|
||||
cosec_muster_roll = json.from_file(common.MUSTER_ROLL_CACHE_FILE)
|
||||
await common.sync_branches_to_tcaoff(
|
||||
tcaoff_client = tcaoff_client,
|
||||
cosec_muster_roll = cosec_muster_roll,
|
||||
)
|
||||
await common.sync_departments_to_tcaoff(
|
||||
tcaoff_client = tcaoff_client,
|
||||
cosec_muster_roll = cosec_muster_roll,
|
||||
)
|
||||
await common.sync_teams_to_tcaoff(
|
||||
tcaoff_client = tcaoff_client,
|
||||
cosec_muster_roll = cosec_muster_roll,
|
||||
)
|
||||
|
||||
# IN-OUT SUMMARY:
|
||||
|
||||
@@ -281,11 +281,11 @@ async def set_scheduler(
|
||||
# If in test mode:
|
||||
if test_mode:
|
||||
printer("Starting Test")
|
||||
# await yesterday_cron(
|
||||
# cosec_creds = copy.deepcopy(cosec_creds),
|
||||
# tcaoff_client = tcaoff_client,
|
||||
# # test_mode = test_mode
|
||||
# )
|
||||
await yesterday_cron(
|
||||
cosec_creds = copy.deepcopy(cosec_creds),
|
||||
tcaoff_client = tcaoff_client,
|
||||
# test_mode = test_mode
|
||||
)
|
||||
await today_cron(
|
||||
cosec_creds = copy.deepcopy(cosec_creds),
|
||||
tcaoff_client = tcaoff_client,
|
||||
@@ -355,12 +355,12 @@ if __name__ == "__main__":
|
||||
tcaoff_client = AsyncTheCAOffice(
|
||||
username = tcaoff_creds["creds"]["username"],
|
||||
password = tcaoff_creds["creds"]["password"],
|
||||
debug_only_errors = True
|
||||
debug_only_errors = False
|
||||
)
|
||||
|
||||
# Schedule the activities:
|
||||
asyncio.run(set_scheduler(
|
||||
cosec_creds = cosec_creds,
|
||||
tcaoff_client = tcaoff_client,
|
||||
test_mode = True
|
||||
test_mode = False
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user