UPDATE
This commit is contained in:
@@ -5,6 +5,7 @@ from typing import Any
|
||||
from django.db.models import Avg, QuerySet
|
||||
|
||||
from .models import (
|
||||
ensure_block_layout_defaults,
|
||||
AnalysisGridObservation,
|
||||
RemoteSensingRun,
|
||||
RemoteSensingSubdivisionResult,
|
||||
@@ -90,7 +91,7 @@ def build_location_block_satellite_snapshots(
|
||||
*,
|
||||
sensor_payload: dict[str, Any] | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
block_layout = location.block_layout or {}
|
||||
block_layout = ensure_block_layout_defaults(location.block_layout, block_count=location.input_block_count)
|
||||
blocks = block_layout.get("blocks") or []
|
||||
if not blocks:
|
||||
return [build_location_satellite_snapshot(location, sensor_payload=sensor_payload)]
|
||||
@@ -112,7 +113,7 @@ def build_block_layout_metric_summary(
|
||||
*,
|
||||
sensor_payload: dict[str, Any] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
layout = dict(location.block_layout or {})
|
||||
layout = ensure_block_layout_defaults(location.block_layout, block_count=location.input_block_count)
|
||||
blocks = [dict(block) for block in (layout.get("blocks") or [])]
|
||||
snapshots_by_block_code = {
|
||||
str(snapshot.get("block_code") or ""): snapshot
|
||||
@@ -461,7 +462,7 @@ def build_block_sensor_summary(
|
||||
|
||||
|
||||
def _build_active_sub_block_lookup(location: SoilLocation) -> dict[str, Any]:
|
||||
block_layout = dict(location.block_layout or {})
|
||||
block_layout = ensure_block_layout_defaults(location.block_layout, block_count=location.input_block_count)
|
||||
by_cluster_uuid: dict[str, dict[str, Any]] = {}
|
||||
by_sub_block_code: dict[str, list[dict[str, Any]]] = {}
|
||||
by_block_and_cluster_label: dict[tuple[str, int], dict[str, Any]] = {}
|
||||
|
||||
Reference in New Issue
Block a user