(20251122) Reformatted the muster roll data to return only unique combinations to reduce the load on the frontend.

This commit is contained in:
2025-11-22 11:35:03 +05:30
parent 6cbcac4545
commit 8f6736cd84
3 changed files with 49 additions and 13 deletions
+6 -6
View File
@@ -124,7 +124,7 @@ def load_from_cosec(
masters_dir = os.path.join(base_dir, r"masters")
# Create an instance of the automation object:
cosec = CosecWeb(
current_app.cosec = CosecWeb(
cosec_url = cosec_url,
username = username,
password = password,
@@ -134,10 +134,10 @@ def load_from_cosec(
)
# Perform the login:
cosec.login(initial_sleep = 2.5)
current_app.cosec.login(initial_sleep = 2.5)
# Get the in/out report:
report_path = cosec.get_muster_roll(
report_path = current_app.cosec.get_muster_roll(
initial_sleep = 1.0,
on_date = on_date or date_time.get_current_utc_date_time(),
group_ids = group_ids,
@@ -145,10 +145,10 @@ def load_from_cosec(
)
# Log out to end the cycle:
cosec.logout()
current_app.cosec.logout()
# Close the browser window:
cosec.quit()
current_app.cosec.quit()
# If we didn't get any path, the download failed:
if report_path is None:
@@ -158,7 +158,7 @@ def load_from_cosec(
# Else, we parse the data and hold it:
else:
current_app.printer("Fetched Muster Roll.")
report_df = cosec.read_muster_roll_xls(report_path)
report_df = current_app.cosec.read_muster_roll_xls(report_path)
report_df = report_df[[
"User ID", "User Name", "Category Name",
"Grade Name", "Branch Name", "Department Name",