Интегрирован wesp в сайт
CI / quality (push) Canceled after 0s

This commit is contained in:
влад
2026-07-17 12:57:18 +03:00
parent 5dfa06ddbe
commit 355c0ef9f1
883 changed files with 194576 additions and 177 deletions
@@ -0,0 +1,38 @@
from __future__ import annotations
from typing import Any
from app.modules.zootech.lab.calc.nutrients import parse_num
from app.modules.zootech.lab.constants import NORM_COLUMN_ALIASES, RATION_QUALITY_INDICATORS
def merge_norms_from_profile(profile_data: Any, ration_type: str) -> dict[str, dict[str, float | None]]:
del ration_type
if not profile_data or not isinstance(profile_data, dict):
return {}
indicators = profile_data.get("indicators")
if isinstance(indicators, dict):
out: dict[str, dict[str, float | None]] = {}
for key, bounds in indicators.items():
if not isinstance(bounds, dict):
continue
out[str(key)] = {
"min": parse_num(bounds.get("min")),
"max": parse_num(bounds.get("max")),
}
return out
out = {}
for defn in RATION_QUALITY_INDICATORS:
key = defn["key"]
aliases = NORM_COLUMN_ALIASES.get(key)
if not aliases:
continue
for alias in aliases:
entry = profile_data.get(alias)
if isinstance(entry, dict):
out[key] = {
"min": parse_num(entry.get("min")),
"max": parse_num(entry.get("max")),
}
break
return out