EpisodeView: Fix empty state.
This commit is contained in:
parent
0e4430bae4
commit
e4fc7c336e
@ -351,15 +351,29 @@ pub(crate) fn episode_exists(title_: &str, podcast_id_: i32) -> Result<bool, Dat
|
|||||||
|
|
||||||
/// Check `episode` table empty
|
/// 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> {
|
pub fn is_episodes_populated() -> Result<bool, DataError> {
|
||||||
use schema::episode::dsl::*;
|
use schema::episode::dsl::*;
|
||||||
|
|
||||||
let db = connection();
|
let db = connection();
|
||||||
let con = db.get()?;
|
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)
|
.get_result(&con)
|
||||||
|
// FIXME: fix the diesel querry
|
||||||
|
.map(|b: i64| {
|
||||||
|
if b == 0 {
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
})
|
||||||
.map_err(From::from)
|
.map_err(From::from)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user