(20260119) Attendance now captures total hours, over-time hours, first in time, and last out time.

This commit is contained in:
2026-01-19 14:02:35 +05:30
parent 9640972085
commit 9423af0919
4 changed files with 139 additions and 8 deletions
+49
View File
@@ -0,0 +1,49 @@
"""
This is a one-time fix script where we need to fix some content of the accounts created.
"""
# Imports:
import os
import pandas as pd
from helpers import tcaoff
from utils_v2.string import json
from utils_v2.system import files
# File paths:
file_dir = files.get_file_directory(include_filename = False)
proj_dir = files.get_parent_directory(file_dir, depth = 1)
tcaoff_creds_file = os.path.join(proj_dir, "creds", "tcaoff.json")
# Load the creds:
tcaoff_creds = json.from_file(tcaoff_creds_file)
# Log in:
tcaoff.login(tcaoff_creds)
# Load the team list:
team_list = tcaoff.team_list(tcaoff_creds)
# Loop through the list,
# check if `applicantNotes` in `json_notes` is a string,
# if it is a string, convert it to a dict/list and update the user:
for team in team_list:
# Extract info:
json_notes = json.from_string(team.get("json_notes", {}))
app_notes = json_notes.get("applicantNotes")
# If the app notes are a string, update them:
if isinstance(app_notes, str):
app_notes = json.from_string(app_notes)
json_notes["applicantNotes"] = app_notes
team["json_notes"] = json.to_string(json_notes, no_space = True)
# Make a pandas DataFrame:
team_df = pd.DataFrame(team_list)
# Log out:
tcaoff.logout(tcaoff_creds)
# Show and save the DF:
print(team_df[:10].to_string())
team_df[["user_id", "json_notes"]].to_csv(r"C:\Users\Khushal P Soonderji\Downloads\20260116_cosec_team_fix.csv", index = False)