403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/home/rmlac2fmr/diag_need_room.py
#!/usr/bin/env python3
"""
Read-only diagnostic for the "NEED A HOTEL / Need Room" section.

It loads db.json and, for the active show, replicates the EXACT logic the
Ops page uses to decide who appears in Need Room. For every travel request
that does NOT currently have an assigned hotel, it prints whether the person
shows in Need Room and, if not, the precise reason.

Nothing is written. Safe to run any time.

Run:  python3 ~/diag_need_room.py
"""

import json, os

DB_PATH = os.path.expanduser("~/public_html/jn.com/ops/data/db.json")
SHOW = "S3"          # ACF2026 active show. Change to "S2" for NMDC, etc.

with open(DB_PATH, "r", encoding="utf-8") as f:
    db = json.load(f)

persons   = {p.get("id"): p for p in db.get("persons", [])}
reqs      = db.get("travelRequests", [])
bookings  = db.get("hotelBookings", [])

def person_exists(pid):
    return pid in persons

def has_assigned_booking(pid):
    return any(
        h.get("personId") == pid and h.get("showId") == SHOW and h.get("assigned")
        for h in bookings
    )

def name_for(r):
    p = persons.get(r.get("personId"))
    if p:
        return f"{p.get('lastName','')}, {p.get('firstName','')}".strip(", ")
    return r.get("submittedName", "(unknown)")

print(f"\n=== NEED ROOM DIAGNOSTIC — show {SHOW} ===")
print(f"DB: {DB_PATH}")
print(f"Total travel requests in DB: {len(reqs)}  |  persons: {len(persons)}  |  hotel bookings: {len(bookings)}\n")

show_reqs = [r for r in reqs if r.get("showId") == SHOW]
print(f"Travel requests on this show: {len(show_reqs)}\n")

showing = []
missing = []   # unassigned but NOT showing in Need Room -> the problem cases
assigned = []

for r in show_reqs:
    pid = r.get("personId")
    if has_assigned_booking(pid):
        assigned.append(r)
        continue

    reasons = []
    if not r.get("hotel"):
        reasons.append("hotel flag NOT set (r.hotel is falsy)")
    if r.get("roomType") == "no_room":
        reasons.append('roomType = "no_room" (marked NO ROOM NEEDED)')
    if not person_exists(pid):
        reasons.append(f"ORPHAN: personId '{pid}' has no matching crew profile")

    if reasons:
        missing.append((r, reasons))
    else:
        showing.append(r)

print(f"--- SHOWING in Need Room (unassigned, all conditions met): {len(showing)} ---")
for r in showing:
    print(f"   {name_for(r):35}  roomType={r.get('roomType','')!r:10}  reqId={r.get('id')}")

print(f"\n--- NOT showing in Need Room but ALSO unassigned (the problem): {len(missing)} ---")
if not missing:
    print("   (none — every unassigned person is correctly listed)")
for r, reasons in missing:
    print(f"   {name_for(r):35}  reqId={r.get('id')}  email={r.get('submittedEmail','')}")
    print(f"        personId : {r.get('personId')!r}")
    print(f"        hotel    : {r.get('hotel')!r}    roomType: {r.get('roomType')!r}    status: {r.get('status')!r}")
    for reason in reasons:
        print(f"        >> {reason}")
    print()

print(f"--- Already assigned a hotel (correctly NOT in Need Room): {len(assigned)} ---\n")

# Extra: any orphaned requests across ALL shows (personId not in crew db)
orphans_all = [r for r in reqs if not person_exists(r.get("personId"))]
print(f"=== ORPHANED travel requests across ALL shows: {len(orphans_all)} ===")
for r in orphans_all:
    print(f"   {r.get('submittedName','(?)'):35}  show={r.get('showId')}  personId={r.get('personId')!r}  reqId={r.get('id')}  email={r.get('submittedEmail','')}")
print()

Youez - 2016 - github.com/yon3zu
LinuXploit