diff options
author | Leif Johansson <leifj@sunet.se> | 2011-05-10 23:23:20 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-05-10 23:23:20 +0200 |
commit | f2170da73142c4f4698177c1b7866fb18477bff9 (patch) | |
tree | fc74e0ceab98a413c42b2e8ccf1b3967fe4e3d62 /src/meetingtools/apps/room | |
parent | 8fe8d48355f07ea19235e624b043743455ee5e09 (diff) |
style polish
Diffstat (limited to 'src/meetingtools/apps/room')
-rw-r--r-- | src/meetingtools/apps/room/models.py | 6 | ||||
-rw-r--r-- | src/meetingtools/apps/room/views.py | 6 |
2 files changed, 8 insertions, 4 deletions
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() |