activity: use left join instead of inner join when fetching activities that may or may not have a child object

This commit is contained in:
William Pitcock 2019-03-23 03:13:19 +00:00
parent 332dc1371b
commit 4aa699271c
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ def get_by_ap_id_with_object(ap_id) do
from( from(
activity in Activity, activity in Activity,
where: fragment("(?)->>'id' = ?", activity.data, ^to_string(ap_id)), where: fragment("(?)->>'id' = ?", activity.data, ^to_string(ap_id)),
inner_join: o in Object, left_join: o in Object,
on: on:
fragment( fragment(
"(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)", "(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)",