User Log and Persistent Faction Information

This commit is contained in:
2026-01-27 14:48:46 -05:00
parent 4ae3a9eb17
commit 4850c16b87
39 changed files with 782 additions and 71 deletions

View File

@@ -1,11 +1,11 @@
"""File I/O helper utilities."""
#File I/O helper utilities
import json
from pathlib import Path
from services.server_state import STATE
def load_json_list(path: Path):
"""Load a JSON file and return it as a list."""
#Load a JSON file and return it as a list
if not path.exists():
return []
with open(path, "r", encoding="utf-8") as f:
@@ -13,10 +13,8 @@ def load_json_list(path: Path):
async def sync_state_from_file(path: Path, kind: str):
"""
Read JSON file (list of members dicts) and upsert into STATE.
Expected member dict keys: id, name, level, estimate, optionally status/hits.
"""
#Read JSON file (list of members dicts) and upsert into STATE.
#Expected member dict keys: id, name, level, estimate, optionally status/hits.
arr = load_json_list(path)
received_ids = []
for m in arr: