Skip to content
Snippets Groups Projects
Commit 52be83b2 authored by Jonas Braathen's avatar Jonas Braathen
Browse files

Make changes in GREG-28 work with the changes from GREG-26.

parent 96f2613b
No related branches found
No related tags found
1 merge request!36Make changes in GREG-28 work with the changes from GREG-26.
Pipeline #91657 passed
...@@ -38,9 +38,9 @@ class PersonFilter(FilterSet): ...@@ -38,9 +38,9 @@ class PersonFilter(FilterSet):
return queryset.annotate( return queryset.annotate(
active=Case( active=Case(
When( When(
Q(person_roles__start_date__isnull=True) Q(roles__start_date__isnull=True)
| Q(person_roles__start_date__lte=datetime_now), | Q(roles__start_date__lte=datetime_now),
person_roles__end_date__gte=datetime_now, roles__end_date__gte=datetime_now,
then=True, then=True,
), ),
default=False, default=False,
......
...@@ -427,13 +427,13 @@ def test_filter_active_includes_person_with_active_role( ...@@ -427,13 +427,13 @@ def test_filter_active_includes_person_with_active_role(
person_foo: Person, person_foo: Person,
sponsor_guy: Sponsor, sponsor_guy: Sponsor,
unit_foo: OrganizationalUnit, unit_foo: OrganizationalUnit,
role_test_guest: Role, role_type_test_guest: RoleType,
): ):
date_today = datetime.date.today() date_today = datetime.date.today()
PersonRole.objects.create( Role.objects.create(
person=person_foo, person=person_foo,
role=role_test_guest, type=role_type_test_guest,
end_date=date_today + datetime.timedelta(days=1), end_date=date_today + datetime.timedelta(days=1),
registered_by=sponsor_guy, registered_by=sponsor_guy,
unit=unit_foo, unit=unit_foo,
...@@ -449,7 +449,7 @@ def test_filter_active_includes_person_with_active_role( ...@@ -449,7 +449,7 @@ def test_filter_active_includes_person_with_active_role(
@pytest.mark.django_db @pytest.mark.django_db
def test_filter_active_excludes_person_with_no_active_role( def test_filter_active_excludes_person_with_no_active_role(
client, person_foo: Person, person_foo_role: PersonRole client, person_foo: Person, person_foo_role: Role
): ):
url = reverse("v1:person-list") url = reverse("v1:person-list")
response = client.get(url, {"active": "true"}) response = client.get(url, {"active": "true"})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment