feature/shuffle-sort #30

Merged
cameron merged 21 commits from feature/shuffle-sort into master 2024-12-06 16:25:44 +00:00
Showing only changes of commit ff13a57d0e - Show all commits

View File

@@ -374,9 +374,14 @@ impl TagDao for SqliteTagDao {
) -> anyhow::Result<Vec<String>> { ) -> anyhow::Result<Vec<String>> {
use diesel::dsl::*; use diesel::dsl::*;
let exclude_subquery = tagged_photo::table
.filter(tagged_photo::tag_id.eq_any(exclude_tag_ids.clone()))
.select(tagged_photo::photo_name)
.into_boxed();
tagged_photo::table tagged_photo::table
.filter(tagged_photo::tag_id.eq_any(tag_ids.clone())) .filter(tagged_photo::tag_id.eq_any(tag_ids.clone()))
.filter(tagged_photo::tag_id.ne_all(exclude_tag_ids)) .filter(tagged_photo::photo_name.ne_all(exclude_subquery))
.group_by(tagged_photo::photo_name) .group_by(tagged_photo::photo_name)
.select((tagged_photo::photo_name, count(tagged_photo::tag_id))) .select((tagged_photo::photo_name, count(tagged_photo::tag_id)))
// .having(count_distinct(tagged_photo::tag_id).eq(tag_ids.len() as i64)) // .having(count_distinct(tagged_photo::tag_id).eq(tag_ids.len() as i64))