feature/shuffle-sort #30

Merged
cameron merged 21 commits from feature/shuffle-sort into master 2024-12-06 16:25:44 +00:00
2 changed files with 13 additions and 4 deletions
Showing only changes of commit 0af7c8f98b - Show all commits

View File

@@ -59,7 +59,7 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
.filter_map(|t| t.parse().ok()) .filter_map(|t| t.parse().ok())
.collect::<Vec<i32>>(); .collect::<Vec<i32>>();
match filter_mode { return match filter_mode {
FilterMode::Any => dao.get_files_with_any_tag_ids(tag_ids.clone(), exclude_tag_ids), FilterMode::Any => dao.get_files_with_any_tag_ids(tag_ids.clone(), exclude_tag_ids),
FilterMode::All => dao.get_files_with_all_tag_ids(tag_ids.clone(), exclude_tag_ids), FilterMode::All => dao.get_files_with_all_tag_ids(tag_ids.clone(), exclude_tag_ids),
} }
@@ -67,8 +67,13 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
"Failed to get files with tag_ids: {:?} with filter_mode: {:?}", "Failed to get files with tag_ids: {:?} with filter_mode: {:?}",
tag_ids, filter_mode tag_ids, filter_mode
)) ))
.inspect(|files| debug!("Found {:?} files", files.len()))
.map(|tagged_files: Vec<String>| { .map(|tagged_files: Vec<String>| {
trace!("Found {:?} tagged files: {:?}", tagged_files.len(), tagged_files); trace!(
"Found {:?} tagged files: {:?}",
tagged_files.len(),
tagged_files
);
HttpResponse::Ok().json(PhotosResponse { HttpResponse::Ok().json(PhotosResponse {
photos: tagged_files, photos: tagged_files,

View File

@@ -506,12 +506,16 @@ mod tests {
fn get_files_with_all_tag_ids( fn get_files_with_all_tag_ids(
&mut self, &mut self,
tag_ids: Vec<i32>, tag_ids: Vec<i32>,
exclude_tag_ids: Vec<i32>, _exclude_tag_ids: Vec<i32>,
) -> anyhow::Result<Vec<String>> { ) -> anyhow::Result<Vec<String>> {
todo!() todo!()
} }
fn get_files_with_any_tag_ids(&mut self, tag_ids: Vec<i32>) -> anyhow::Result<Vec<String>> { fn get_files_with_any_tag_ids(
&mut self,
_tag_ids: Vec<i32>,
_exclude_tag_ids: Vec<i32>,
) -> anyhow::Result<Vec<String>> {
todo!() todo!()
} }
} }