Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions partner_programs/services/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def participant_data(profile):
"email": profile.user.email,
"city": profile.user.city,
"registered_at": profile.datetime_created,
"last_activity": profile.user.last_activity,
}


Expand Down
15 changes: 15 additions & 0 deletions partner_programs/tests/test_management_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ def test_participants_have_email_and_program_registration_and_server_search(self
)
self.assertEqual(by_email.data["count"], 1)

def test_participants_last_activity_is_nullable_and_uses_tracked_activity(self):
timestamp = timezone.now().replace(microsecond=0)
for activity in (timestamp, None):
with self.subTest(last_activity=activity):
self.member.user.__class__.objects.filter(pk=self.member.user_id).update(
last_activity=activity, last_login=timestamp + timedelta(minutes=1)
)
response = self.client.get(self.url("management-participants"))
self.assertEqual(response.status_code, 200)
row = response.json()["results"][0]
expected = (
activity.isoformat().replace("+00:00", "Z") if activity else None
)
self.assertEqual(row["last_activity"], expected)

def test_bad_query_is_not_silently_defaulted(self):
for query in [
{"limit": 101},
Expand Down
Loading