added formulas

This commit is contained in:
2026-06-26 12:30:19 +03:00
parent 83ca6bc12c
commit 6324b7a95e
3 changed files with 29 additions and 1 deletions
Binary file not shown.
+3 -1
View File
@@ -23,7 +23,9 @@ def _artifact_path(job_id: str) -> Path:
status_code=status.HTTP_409_CONFLICT,
detail={"code": "JOB_NOT_READY", "detail": "Job is not finished yet"},
)
uri = (record.get("result") or {}).get("uri")
result = record.get("result") or {}
data = result.get("data") if isinstance(result.get("data"), dict) else {}
uri = result.get("uri") or data.get("uri")
if not uri:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
+26
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
import pytest
import rasterio
@@ -8,6 +9,7 @@ import rasterio
from app.core import coverage as coverage_core
from app.core.antenna import AntennaPattern, gain
from app.core.coverage import compute_coverage
from app.routers import jobs as jobs_router
from app.core.surface import SurfaceProfile, SurfaceSample
from app.core.vegetation import WORLDCOVER_P833, p833_coefficients_for_class
from app.models.coverage import CoverageRequest
@@ -24,6 +26,30 @@ def test_jobs_store_roundtrip() -> None:
assert response.result == {"ok": True}
def test_job_artifact_path_supports_nested_coverage_uri(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
artifact = tmp_path / "coverage.png"
artifact.write_bytes(b"png")
job_id = jobs.create_job("coverage", {"model": "fspl"})
jobs.update_job(
job_id,
status="done",
result={
"kind": "coverage",
"data": {"kind": "coverage_raster", "uri": str(artifact)},
},
)
monkeypatch.setattr(
jobs_router,
"get_settings",
lambda: SimpleNamespace(jobs_output_path=tmp_path),
)
assert jobs_router._artifact_path(job_id) == artifact.resolve()
def test_coverage_fspl_geojson() -> None:
request = _coverage_request(format="geojson", radius_m=5000, range_step_m=500)
result = compute_coverage(request)