Add overlay command
This commit is contained in:
8 files changed
+137
-28
No files matched your search
+3
-6
@@ -58,11 +58,9 @@ impl Movie {
|
||||
.next()
|
||||
.ok_or(JDbError::NotFound)?)
|
||||
}
|
||||
|
||||
|
||||
pub fn get_movies(db: &Database) -> Result<Vec<Self>, Error> {
|
||||
Ok(db
|
||||
.filter(|_, _movie: &Movie| true)?
|
||||
.collect())
|
||||
Ok(db.filter(|_, _movie: &Movie| true)?.collect())
|
||||
}
|
||||
|
||||
pub fn remove_movie(db: &Database, name: &str) -> Result<Self, Error> {
|
||||
@@ -86,8 +84,7 @@ impl Movie {
|
||||
pub fn calculate_rating(&self) -> f32 {
|
||||
if self.ratings.is_empty() {
|
||||
0.0
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self.ratings.values().copied().sum::<f32>() / self.ratings.len() as f32
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user