datatracker/ietf/stats/factories.py
Robert Sparks 6dd6165444
fix: correct meeting attendance calculations (#4536)
* fix: correct meeting attendance calculations

* test: change meetingregistration factory defaults

* test: Setup stats tests to verify counts honor meeting.Attended

But the tests aren't actually looking to see what numbers get generated yet.

* test: add test for attendance cross-talk between meetings

* fix: limit attendance count query to single meeting

* refactor: rename attendance.online to .remote

* fix: only count a given person as onsite or remote, but never both

* test: align tests with cleanup

Co-authored-by: Jennifer Richards <jennifer@painless-security.com>
2022-10-13 10:55:57 -05:00

20 lines
654 B
Python

# Copyright The IETF Trust 2021, All Rights Reserved
import factory
from ietf.stats.models import MeetingRegistration
from ietf.meeting.factories import MeetingFactory
from ietf.person.factories import PersonFactory
class MeetingRegistrationFactory(factory.django.DjangoModelFactory):
class Meta:
model = MeetingRegistration
meeting = factory.SubFactory(MeetingFactory)
person = factory.SubFactory(PersonFactory)
reg_type = 'onsite'
first_name = factory.LazyAttribute(lambda obj: obj.person.first_name())
last_name = factory.LazyAttribute(lambda obj: obj.person.last_name())
attended = False
checkedin = False