(20251122) Reverted formatting and added a semaphore.

This commit is contained in:
2025-11-22 14:57:40 +05:30
parent cbc151570b
commit 071f86e552
4 changed files with 71 additions and 59 deletions
+24 -22
View File
@@ -176,31 +176,33 @@ async def muster_roll_report_generate(
report_data = None
# Get the muster roll data:
report_data = muster_roll.load(
cosec_url = inbound_headers.cosecUrl,
username = inbound_headers.cosecUsername,
password = inbound_headers.cosecPassword,
group_ids = inbound_data.groupIds,
on_date = inbound_data.onDate,
)
async with current_app.chrome_semaphore:
report_data = muster_roll.load(
cosec_url = inbound_headers.cosecUrl,
username = inbound_headers.cosecUsername,
password = inbound_headers.cosecPassword,
group_ids = inbound_data.groupIds,
on_date = inbound_data.onDate,
)
# If data was loaded:
if report_data is not None:
report_data = report_data.copy()
report_data = report_data[[
"User ID", "User Name", "Category Name",
"Grade Name", "Branch Name", "Department Name",
"Direct Reporting", "Level-1"
]]
unique_branches = report_data["Branch Name"].unique().tolist()
unique_depts = report_data[["Branch Name", "Department Name"]].drop_duplicates().to_dict(orient = "records")
unique_reportees = report_data[["Branch Name", "Department Name", "Direct Reporting"]].drop_duplicates().to_dict(orient = "records")
unique_combos = {
"Branch Name": unique_branches,
"Department Name": unique_depts,
"Direct Reporting": unique_reportees
}
report_data = unique_combos
# report_data = report_data.copy()
# report_data = report_data[[
# "User ID", "User Name", "Category Name",
# "Grade Name", "Branch Name", "Department Name",
# "Direct Reporting", "Level-1"
# ]]
# unique_branches = report_data["Branch Name"].unique().tolist()
# unique_depts = report_data[["Branch Name", "Department Name"]].drop_duplicates().to_dict(orient = "records")
# unique_reportees = report_data[["Branch Name", "Department Name", "Direct Reporting"]].drop_duplicates().to_dict(orient = "records")
# unique_combos = {
# "Branch Name": unique_branches,
# "Department Name": unique_depts,
# "Direct Reporting": unique_reportees
# }
# report_data = unique_combos
report_data = report_data.to_dict(orient = "records")
success = True
# ┳┓