| Server IP : 216.92.14.13 / Your IP : 216.73.217.126 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 : |
#!/usr/bin/env python3
"""
Read-only lookup for one crew member.
Prints their crew profile, every travel request, and every hotel booking
tied to them — so we can see exactly why they are / aren't in Need Room.
Nothing is written. Safe to run any time.
Run: python3 ~/diag_lookup.py
Change LAST / FIRST below to look up someone else.
"""
import json, os
DB_PATH = os.path.expanduser("~/public_html/jn.com/ops/data/db.json")
LAST = "Hunter"
FIRST = "Drew"
with open(DB_PATH, "r", encoding="utf-8") as f:
db = json.load(f)
persons = db.get("persons", [])
reqs = db.get("travelRequests", [])
bookings = db.get("hotelBookings", [])
def matches(first, last):
return (last or "").strip().lower() == LAST.lower() and \
(first or "").strip().lower().startswith(FIRST.lower())
# Find the person profile(s)
matched_people = [p for p in persons if matches(p.get("firstName"), p.get("lastName"))]
matched_ids = {p.get("id") for p in matched_people}
print(f"\n=== LOOKUP: {FIRST} {LAST} ===")
print(f"DB: {DB_PATH}\n")
print(f"--- CREW PROFILE(S) [{len(matched_people)}] ---")
if not matched_people:
print(" NO crew profile found with this name.")
for p in matched_people:
print(f" id={p.get('id')!r} {p.get('firstName')} {p.get('lastName')} "
f"email={p.get('email')!r} dept={p.get('dept')!r} title={p.get('title')!r}")
print()
# Travel requests: by personId OR by submitted name
print("--- TRAVEL REQUEST(S) ---")
trs = [r for r in reqs
if r.get("personId") in matched_ids
or (LAST.lower() in (r.get("submittedName","").lower())
and FIRST.lower() in (r.get("submittedName","").lower()))]
if not trs:
print(" NO travel request found.")
for r in trs:
print(f" reqId={r.get('id')!r} show={r.get('showId')!r} personId={r.get('personId')!r} "
f"submittedName={r.get('submittedName')!r}")
print(f" status={r.get('status')!r} hotel={r.get('hotel')!r} "
f"roomType={r.get('roomType')!r} source={r.get('source')!r} submittedDate={r.get('submittedDate')!r}")
bd = r.get("bookingDetails") or {}
print(f" bookingDetails.hotelName={bd.get('hotelName')!r} "
f"hotelCheckIn={bd.get('hotelCheckIn')!r} hotelCheckOut={bd.get('hotelCheckOut')!r}")
print()
# Hotel bookings: by personId OR by name on the booking
print("--- HOTEL BOOKING(S) ---")
hbs = [h for h in bookings
if h.get("personId") in matched_ids
or matches(h.get("firstName"), h.get("lastName"))]
if not hbs:
print(" NO hotel booking found (so the req path should list them in Need Room).")
for h in hbs:
print(f" bookingId={h.get('id')!r} show={h.get('showId')!r} personId={h.get('personId')!r}")
print(f" assigned={h.get('assigned')!r} status={h.get('status')!r} hotel={h.get('hotel')!r}")
print(f" checkIn={h.get('checkIn')!r} checkOut={h.get('checkOut')!r} "
f"roomType={h.get('roomType')!r} conf={h.get('conf')!r}")
print()
# Verdict
print("--- WHY NEED ROOM DOES / DOESN'T SHOW THEM ---")
for r in trs:
pid = r.get("personId")
assigned_bk = [h for h in bookings
if h.get("personId") == pid and h.get("showId") == r.get("showId") and h.get("assigned")]
if not r.get("hotel"):
print(f" reqId {r.get('id')}: EXCLUDED — hotel flag not set")
elif r.get("roomType") == "no_room":
print(f" reqId {r.get('id')}: EXCLUDED — roomType is no_room")
elif pid not in matched_ids:
print(f" reqId {r.get('id')}: EXCLUDED — orphan (personId {pid!r} not a crew profile)")
elif assigned_bk:
for h in assigned_bk:
tag = "PHANTOM (no hotel name)" if not (h.get('hotel') or '').strip() else "real hotel"
print(f" reqId {r.get('id')}: EXCLUDED — has assigned booking {h.get('id')!r} [{tag}]")
else:
print(f" reqId {r.get('id')}: SHOULD show in Need Room")
print()