Skip to content

Commit

Permalink
Merge pull request #168 from edx/aj/fix-schedules-app
Browse files Browse the repository at this point in the history
Fix schedules app
  • Loading branch information
awaisdar001 authored Jan 30, 2020
2 parents 25baa93 + 0470e43 commit 561fb8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions openedx/core/djangoapps/schedules/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def get_schedules_with_target_date_by_bin_and_orgs(
}
users = User.objects.filter(
courseenrollment__is_active=True,
is_active=True,
**schedule_day_equals_target_day_filter
).annotate(
id_mod=self.bin_num_for_user_id(F('id'))
Expand Down
12 changes: 12 additions & 0 deletions openedx/core/djangoapps/schedules/tests/test_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,15 @@ def test_schedule_context_show_unsubscribe(self):
resolver = self.create_resolver()
schedules = list(resolver.schedules_for_bin())
self.assertIn('optout', schedules[0][2]['unsubscribe_url'])

@override_waffle_flag(COURSE_UPDATE_WAFFLE_FLAG, True)
def test_get_schedules_with_target_date_by_bin_and_orgs_filter_inactive_users(self):
"""Tests that schedules of inactive users are excluded"""
resolver = self.create_resolver()
schedules = resolver.get_schedules_with_target_date_by_bin_and_orgs()

self.assertEqual(schedules.count(), 1)
self.user.is_active = False
self.user.save()
schedules = resolver.get_schedules_with_target_date_by_bin_and_orgs()
self.assertEqual(schedules.count(), 0)

0 comments on commit 561fb8c

Please sign in to comment.