EpisodeView: Fix empty state.

This commit is contained in:
Jordan Petridis 2018-04-19 05:32:27 +03:00
parent 0e4430bae4
commit e4fc7c336e
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -351,15 +351,29 @@ pub(crate) fn episode_exists(title_: &str, podcast_id_: i32) -> Result<bool, Dat
/// Check `episode` table empty
///
/// Return true if `episode` table is populated.
// FIXME: Return true if `episode` table is populated.
pub fn is_episodes_populated() -> Result<bool, DataError> {
use schema::episode::dsl::*;
let db = connection();
let con = db.get()?;
select(exists(episode.count()))
// FIXME
// select(exists(select(episode)))
// .get_result(&con)
// .map_err(From::from)
episode
.count()
.get_result(&con)
// FIXME: fix the diesel querry
.map(|b: i64| {
if b == 0 {
false
} else {
true
}
})
.map_err(From::from)
}