Merge pull request #16 from wagesj45/codex/organize-domain-reports-in-subdirectory

Organize domain report outputs
This commit is contained in:
Jordan Wages 2025-07-18 02:25:49 -05:00 committed by GitHub
commit 02f6b400ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -85,7 +85,7 @@ Use the `run-reports.sh` script to run all report intervals in one step. The scr
./run-reports.sh
```
Running this script will create or update the hourly, daily, weekly and monthly reports under `output/`. It also detects all unique domains found in the database and writes per-domain reports to `output/<domain>/<interval>` alongside the aggregate data.
Running this script will create or update the hourly, daily, weekly and monthly reports under `output/`. It also detects all unique domains found in the database and writes per-domain reports to `output/domains/<domain>/<interval>` alongside the aggregate data.
## Serving Reports with Nginx

View file

@ -90,7 +90,7 @@ def _generate_interval(interval: str, domain: Optional[str] = None) -> None:
cur.execute(
f"CREATE TEMP VIEW logs_view AS SELECT * FROM logs WHERE host = '{safe_domain}'"
)
out_dir = OUTPUT_DIR / domain / interval
out_dir = OUTPUT_DIR / "domains" / domain / interval
else:
cur.execute("CREATE TEMP VIEW logs_view AS SELECT * FROM logs")
out_dir = OUTPUT_DIR / interval

View file

@ -122,6 +122,6 @@ def test_generate_interval_domain_filter(tmp_path, sample_reports, monkeypatch):
gr._generate_interval("hourly", "example.com")
hits = json.loads(
(tmp_path / "output" / "example.com" / "hourly" / "hits.json").read_text()
(tmp_path / "output" / "domains" / "example.com" / "hourly" / "hits.json").read_text()
)
assert hits[0]["value"] == 2