From a3280330c6688b123e94193273909f1dbd6181ec Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 8 Feb 2017 18:26:12 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20update=5Fnas()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abonapp/views.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/abonapp/views.py b/abonapp/views.py index 9f326b6..4361cef 100644 --- a/abonapp/views.py +++ b/abonapp/views.py @@ -492,19 +492,13 @@ def update_nas(request, group_id): try: tm = Transmitter() for usr in users: - if usr.ip_address: - user_ip = usr.ip_address.int_ip() - else: + if not usr.ip_address: continue - tariff = usr.active_tariff() - if tariff: - agent_trf = TariffStruct(tariff.id, tariff.speedIn, tariff.speedOut) + agent_abon = usr.build_agent_struct() + queue = tm.find_queue('uid%d' % usr.pk) + if queue: + tm.update_user(agent_abon, queue.sid) else: - agent_trf = TariffStruct() - agent_abon = AbonStruct(usr.id, user_ip, agent_trf) - try: - tm.update_user(agent_abon) - except NasFailedResult: tm.add_user(agent_abon) except NasFailedResult as e: messages.error(request, e)