| Server IP : 216.92.14.13 / Your IP : 216.73.216.171 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/home/rmlac2fmr/ |
Upload File : |
import json
from datetime import datetime
db = json.load(open("/home/rmlac2fmr/public_html/jn.com/ops/data/db.json"))
def recalc_pd(name_match):
for pd in db["perDiems"]:
r = next((r for r in db["travelRequests"] if r["id"] == pd.get("reqId","")), None)
if not r or name_match not in r.get("submittedName","").lower():
continue
bd = r.get("bookingDetails", {})
hb = next((h for h in db.get("hotelBookings",[]) if h.get("personId") == r.get("personId") and h.get("showId") == r.get("showId")), None)
checkIn = bd.get("hotelCheckIn") or r.get("hotelCheckIn") or (hb["checkIn"] if hb else "") or r.get("depDate") or ""
checkOut = bd.get("hotelCheckOut") or r.get("hotelCheckOut") or (hb["checkOut"] if hb else "") or r.get("retDate") or ""
if checkIn and checkOut:
ci = datetime.strptime(checkIn, "%Y-%m-%d")
co = datetime.strptime(checkOut, "%Y-%m-%d")
nights = (co - ci).days
old_auto = pd.get("autoDays", 0)
pd["checkIn"] = checkIn
pd["checkOut"] = checkOut
pd["autoDays"] = nights + 1
pd["autoNights"] = nights
print(f" {name_match.upper()}: {checkIn} to {checkOut} = {nights + 1} days (was {old_auto})")
else:
print(f" {name_match.upper()}: still no dates found")
# Fix Carney - clear manual overrides
print("=== CARNEY ===")
for pd in db["perDiems"]:
r = next((r for r in db["travelRequests"] if r["id"] == pd.get("reqId","")), None)
if r and "carney" in r.get("submittedName","").lower():
print(f" Was: manualDays:{pd.get('manualDays')} autoDays:{pd.get('autoDays')}")
pd["manualDays"] = None
pd["manualRate"] = None
print(f" Cleared manual overrides -> will use autoDays:{pd['autoDays']}")
# Fix Schaff - sync eligibility
print("\n=== SCHAFF ===")
for r in db["travelRequests"]:
if "schaff" in r.get("submittedName","").lower():
if r.get("checklist",{}).get("pd_ineligible"):
if not r.get("bookingDetails"):
r["bookingDetails"] = {}
r["bookingDetails"]["pdEligible"] = False
print(f" Synced bd.pdEligible = False (checklist says ineligible)")
# Recalculate Kent
print("\n=== KENT ===")
recalc_pd("kent")
# Recalculate Odze
print("\n=== ODZE ===")
recalc_pd("odze")
json.dump(db, open("/home/rmlac2fmr/public_html/jn.com/ops/data/db.json", "w"), indent=2)
print("\nDone!")