From f2170da73142c4f4698177c1b7866fb18477bff9 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Tue, 10 May 2011 23:23:20 +0200 Subject: style polish --- src/meetingtools/apps/room/models.py | 6 ++++++ src/meetingtools/apps/room/views.py | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/meetingtools') diff --git a/src/meetingtools/apps/room/models.py b/src/meetingtools/apps/room/models.py index a71e608..00f54b4 100644 --- a/src/meetingtools/apps/room/models.py +++ b/src/meetingtools/apps/room/models.py @@ -40,4 +40,10 @@ class Room(models.Model): else: return int(time.mktime(self.lastvisited.timetuple())*1000) + def nusers(self): + if not self.user_count: + return "unknown" + else: + return self.user_count + tagging.register(Room) \ No newline at end of file diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index 201509e..c77f81d 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -330,13 +330,11 @@ def go_by_path(request,path): def goto(request,room): api = ac_api_client(request, room.acc) session_info = api.request('report-meeting-sessions',{'sco-id':room.sco_id}) - now = time.time() + room.user_count = _nusers(session_info) if room.self_cleaning: - nusers = _nusers(session_info) - if (nusers == 0) and (abs(room.lastvisit() - now) > GRACE): + if (room.user_count == 0) and (abs(room.lastvisit() - now) > GRACE): room = _clean(request,room) - room.user_count = nusers room.lastvisited = datetime.now() room.save() -- cgit v1.1