+ session_key=session_key,
+ chunk=chunk,
+ until__gt=now() - timedelta(seconds=cls.GAP_THRESHOLD)
+ ).order_by('-until').first()
+ if report is None or report.active != active:
+ report = cls.objects.create(
+ user=user,
+ session_key=session_key,
+ chunk=chunk,
+ active=active,
+ until=now(),
+ )
+ else:
+ report.until = now()
+ report.save()
+
+ @classmethod
+ def get_current(cls, session_key, chunk):
+ sessions = set()
+ presences = []
+ for p in cls.objects.filter(