Add source mocked data file, make current_pto tool functional, rename future_pto to future_pto_calc

This commit is contained in:
Laine
2025-03-13 11:33:38 -04:00
parent ea1ad383bb
commit 5c3bfcf957
8 changed files with 66 additions and 24 deletions

View File

@@ -1,14 +1,26 @@
from pathlib import Path
import json
def current_pto(args: dict) -> dict:
email = args.get("email")
if email == "bob.johnson@emailzzz.com":
num_hours = 40
else:
num_hours = 20
num_days = float(num_hours/8)
file_path = Path(__file__).resolve().parent / "data" / "employee_pto_data.json"
if not file_path.exists():
return {"error": "Data file not found."}
data = json.load(open(file_path))
employee_list = data["theCompany"]["employees"]
return {
"num_hours": num_hours,
"num_days": num_days,
}
for employee in employee_list:
if employee["email"] == email:
num_hours = int(employee["currentPTOHrs"])
num_days = float(num_hours/8)
return {
"num_hours": num_hours,
"num_days": num_days,
}
return_msg = "Employee not found with email address " + email
return {"error": return_msg}