#101 Fix number of returned results
Merged 5 months ago by lsedlar. Opened 5 months ago by lsedlar.
lsedlar/cts fix-paging  into  master

file modified
-1
@@ -200,7 +200,6 @@ 

              # Get just composes without any Compose.tags.

              query = query.filter(~Compose.tags.any())

          else:

-             query = query.outerjoin(Compose.tags, aliased=True)

              for tag in tags:

                  if tag.startswith("-"):

                      query = query.filter(~Compose.tags.any(Tag.name == tag[1:]))

When a filter for a tag is used, the number of returned items on a page did not match what was requested. This was caused by using an outer join
with the tag/compose mapping table.

However, the join is not needed, since the filter for tags is actually using nested queries:

SELECT ... FROM composes
WHERE NOT (EXISTS (SELECT 1 from tags_to_composes, tags ...))

Looks good to me. :thumbsup:

Pull-Request has been merged by lsedlar

5 months ago
Metadata