User Log and Persistent Faction Information
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user