diff --git a/README.md b/README.md index 21265a0..be7155f 100644 --- a/README.md +++ b/README.md @@ -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//` 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//` alongside the aggregate data. ## Serving Reports with Nginx diff --git a/scripts/generate_reports.py b/scripts/generate_reports.py index 7ac103a..2a7eb73 100644 --- a/scripts/generate_reports.py +++ b/scripts/generate_reports.py @@ -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 diff --git a/tests/test_reports.py b/tests/test_reports.py index 8905960..3b4ef35 100644 --- a/tests/test_reports.py +++ b/tests/test_reports.py @@ -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