Mark task 19 done and centralize map-color thresholds in settings_service
This commit is contained in:
@@ -15,12 +15,6 @@ import structlog
|
||||
|
||||
from app.db import init_db, open_db
|
||||
from app.repositories import settings_repo
|
||||
from app.services.settings_service import (
|
||||
get_map_color_thresholds as util_get_map_color_thresholds,
|
||||
)
|
||||
from app.services.settings_service import (
|
||||
set_map_color_thresholds as util_set_map_color_thresholds,
|
||||
)
|
||||
from app.utils.async_utils import run_blocking
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -195,30 +189,3 @@ async def get_timezone(db: aiosqlite.Connection) -> str:
|
||||
return tz if tz else "UTC"
|
||||
|
||||
|
||||
async def get_map_color_thresholds(
|
||||
db: aiosqlite.Connection,
|
||||
) -> tuple[int, int, int]:
|
||||
"""Return the configured map color thresholds (high, medium, low)."""
|
||||
return await util_get_map_color_thresholds(db)
|
||||
|
||||
|
||||
async def set_map_color_thresholds(
|
||||
db: aiosqlite.Connection,
|
||||
*,
|
||||
threshold_high: int,
|
||||
threshold_medium: int,
|
||||
threshold_low: int,
|
||||
) -> None:
|
||||
"""Update the map color threshold configuration."""
|
||||
await util_set_map_color_thresholds(
|
||||
db,
|
||||
threshold_high=threshold_high,
|
||||
threshold_medium=threshold_medium,
|
||||
threshold_low=threshold_low,
|
||||
)
|
||||
log.info(
|
||||
"map_color_thresholds_updated",
|
||||
high=threshold_high,
|
||||
medium=threshold_medium,
|
||||
low=threshold_low,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user