def here_today(self, day=None): if not day: day = datetime.now(pytz.timezone(TIME_ZONE)).date() # The members who are on the network from arpwatch.arp import users_for_day_query arp_members_query = users_for_day_query(day=day) # The members who have signed in daily_members_query = User.objects.filter(id__in=CoworkingDay.objects.filter(visit_date=day).values('user__id')) # The members that have access a door door_query = DoorEvent.objects.users_for_day(day) door_members_query = User.helper.active_members().filter(id__in=door_query.values('user')) combined_query = arp_members_query | daily_members_query | door_members_query return combined_query.distinct()
def here_today(self, target_date=None): if not target_date: target_date = localtime(now()).date() # The members who are on the network from arpwatch.arp import users_for_day_query arp_members_query = users_for_day_query(day=target_date).distinct() # The members who have signed in daily_members_query = User.objects.filter(id__in=CoworkingDay.objects.filter(visit_date=target_date).values('user__id')).distinct() # The members that have accessed a door door_query = DoorEvent.objects.users_for_day(target_date) door_members_query = User.helper.active_members().filter(id__in=door_query.values('user__id')) combined_query = arp_members_query | daily_members_query | door_members_query return combined_query.distinct()
def here_today(self, day=None): if not day: day = timezone.now().date() # The members who are on the network from arpwatch.arp import users_for_day_query arp_members_query = users_for_day_query(day=day) # The members who have signed in daily_members_query = Member.objects.filter(pk__in=DailyLog.objects.filter(visit_date=day).values('member__id')) # The members that have access a door door_query = DoorEvent.objects.users_for_day(day) door_members_query = Member.objects.active_members().filter(user__in=door_query.values('user')) combined_query = arp_members_query | daily_members_query | door_members_query return combined_query.distinct()