A1: guard None/empty args in distance_service coefficients
This commit is contained in:
@@ -118,6 +118,8 @@ def get_terrain_coefficient(terrain: str) -> float:
|
|||||||
Returns:
|
Returns:
|
||||||
Terrain coefficient (0.0 - 1.0)
|
Terrain coefficient (0.0 - 1.0)
|
||||||
"""
|
"""
|
||||||
|
if not terrain:
|
||||||
|
return 0.5
|
||||||
terrain_lower = terrain.lower()
|
terrain_lower = terrain.lower()
|
||||||
|
|
||||||
terrain_map = {
|
terrain_map = {
|
||||||
@@ -155,6 +157,8 @@ def get_time_of_day_coefficient(time_of_day: str) -> float:
|
|||||||
Returns:
|
Returns:
|
||||||
Time coefficient (0.0 - 1.0)
|
Time coefficient (0.0 - 1.0)
|
||||||
"""
|
"""
|
||||||
|
if not time_of_day:
|
||||||
|
return 1.0
|
||||||
time_lower = time_of_day.lower()
|
time_lower = time_of_day.lower()
|
||||||
|
|
||||||
if 'ночь' in time_lower:
|
if 'ночь' in time_lower:
|
||||||
@@ -175,6 +179,8 @@ def get_weather_coefficient(weather: str) -> float:
|
|||||||
Returns:
|
Returns:
|
||||||
Weather coefficient (0.0 - 1.0)
|
Weather coefficient (0.0 - 1.0)
|
||||||
"""
|
"""
|
||||||
|
if not weather:
|
||||||
|
return 1.0
|
||||||
weather_lower = weather.lower()
|
weather_lower = weather.lower()
|
||||||
|
|
||||||
if 'ливень' in weather_lower or 'сильный дождь' in weather_lower:
|
if 'ливень' in weather_lower or 'сильный дождь' in weather_lower:
|
||||||
|
|||||||
Reference in New Issue
Block a user