mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-29 05:07:23 +01:00
New search page
This commit is contained in:
parent
a6e0935df8
commit
cff489f43e
12 changed files with 830 additions and 793 deletions
|
|
@ -1,7 +1,7 @@
|
|||
//! This module contains higher-level models combining information from
|
||||
//! multiple database tables.
|
||||
|
||||
use std::fmt::Display;
|
||||
use std::{collections::HashSet, fmt::Display};
|
||||
|
||||
use anyhow::Result;
|
||||
use diesel::prelude::*;
|
||||
|
|
@ -392,6 +392,27 @@ impl Album {
|
|||
recordings,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn performers_string(&self) -> String {
|
||||
let mut performers = HashSet::new();
|
||||
let mut ensembles = HashSet::new();
|
||||
|
||||
for recording in &self.recordings {
|
||||
for performer in &recording.persons {
|
||||
performers.insert(performer.to_string());
|
||||
}
|
||||
|
||||
for ensemble in &recording.ensembles {
|
||||
ensembles.insert(ensemble.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
performers
|
||||
.into_iter()
|
||||
.chain(ensembles)
|
||||
.collect::<Vec<String>>()
|
||||
.join(", ")
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Album {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue