Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bellisk/ckanext-subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
bellisk committed Jan 3, 2023
2 parents f90788f + 0d41b6c commit 4ba42c9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ckanext/subscribe/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ def get_objects_subscribed_to(subscription_frequency):
objects_subscribed_to = defaultdict(list) # {object_id: [subscriptions]}
# direct subscriptions - i.e. datasets, orgs & groups
for subscription in model.Session.query(Subscription) \
.filter(Subscription.verified.is_(True)) \
.filter(Subscription.frequency == subscription_frequency).all():
objects_subscribed_to[subscription.object_id].append(subscription)
# also include the datasets attached to the subscribed orgs
for subscription, package_id in model.Session.query(Subscription, Package.id) \
.filter(Subscription.verified.is_(True)) \
.filter(Subscription.frequency == subscription_frequency) \
.join(Group, Group.id == Subscription.object_id) \
.filter(Group.state == 'active') \
Expand All @@ -156,6 +158,7 @@ def get_objects_subscribed_to(subscription_frequency):
objects_subscribed_to[package_id].append(subscription)
# also include the datasets attached to the subscribed orgs
for subscription, package_id in model.Session.query(Subscription, Package.id) \
.filter(Subscription.verified.is_(True)) \
.filter(Subscription.frequency == subscription_frequency) \
.join(Group, Group.id == Subscription.object_id) \
.filter(Group.state == 'active') \
Expand Down

0 comments on commit 4ba42c9

Please sign in to comment.