fix preserve device/traffic limits on coupon

This commit is contained in:
Capybara-z
2026-02-07 22:48:30 +03:00
parent 7f6f00286c
commit 8693115571
+5 -2
View File
@@ -235,8 +235,11 @@ async def handle_key_extension(
tariff = None
if key.tariff_id:
tariff = await get_tariff_by_id(session, key.tariff_id)
total_gb = int(tariff["traffic_limit"]) if tariff and tariff.get("traffic_limit") else 0
device_limit = int(tariff["device_limit"]) if tariff and tariff.get("device_limit") else 0
tariff_gb = int(tariff["traffic_limit"]) if tariff and tariff.get("traffic_limit") else 0
tariff_devices = int(tariff["device_limit"]) if tariff and tariff.get("device_limit") else 0
total_gb = int(key.current_traffic_limit) if getattr(key, "current_traffic_limit", None) is not None else tariff_gb
device_limit = int(key.current_device_limit) if getattr(key, "current_device_limit", None) is not None else tariff_devices
key_subgroup = None
if tariff: