Update inline.py

This commit is contained in:
Egor
2026-02-01 17:16:28 +03:00
committed by GitHub
parent afadf7160c
commit 7d9d1b0a6f
+5 -1
View File
@@ -1966,7 +1966,11 @@ def get_change_devices_keyboard(
else:
max_devices = settings.MAX_DEVICES_LIMIT if settings.MAX_DEVICES_LIMIT > 0 else 20
start_range = max(1, min(current_devices - 3, max_devices - 6))
# Минимальное количество устройств: device_limit тарифа или 1
tariff_min_devices = (getattr(tariff, 'device_limit', 1) or 1) if tariff else 1
min_devices = max(1, tariff_min_devices)
start_range = max(min_devices, min(current_devices - 3, max_devices - 6))
end_range = min(max_devices + 1, max(current_devices + 4, 7))
for devices_count in range(start_range, end_range):