From 5f0b20b7624576dd312382436ae23b4047c4c08c Mon Sep 17 00:00:00 2001 From: Johan Lundberg Date: Fri, 28 Mar 2014 14:49:46 +0100 Subject: Stop processing UserMeetingTransactions if status != completed. --- meetingtools/apps/stats/tasks.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/meetingtools/apps/stats/tasks.py b/meetingtools/apps/stats/tasks.py index 9e2f437..1d379e2 100644 --- a/meetingtools/apps/stats/tasks.py +++ b/meetingtools/apps/stats/tasks.py @@ -28,14 +28,15 @@ def import_acc_sessions(acc,since=0,room_last_visited=False): for tx in r.et.findall(".//row"): try: tx = UserMeetingTransaction.create(acc,tx) - if room_last_visited: - rooms = Room.objects.filter(sco=tx.sco) - if len(rooms) == 1: - room = rooms[0] - if room.lastvisited is None or room.lastvisited < tx.date_closed: - room.lastvisited = tx.date_created - room.save() - nr += 1 + if tx: + if room_last_visited: + rooms = Room.objects.filter(sco=tx.sco) + if len(rooms) == 1: + room = rooms[0] + if room.lastvisited is None or room.lastvisited < tx.date_closed: + room.lastvisited = tx.date_created + room.save() + nr += 1 except Exception,ex: logging.error(ex) ne += 1 -- cgit v1.1