ShowWidget: Initial Lazier evaluation of the widgets.

This commit is contained in:
Jordan Petridis
2018-04-10 16:57:08 +00:00
committed by Merge Bot, Bors Wannabe
parent 5cd0a3c451
commit 9cb2782ef9
3 changed files with 46 additions and 9 deletions
+10
View File
@@ -175,6 +175,16 @@ pub fn get_pd_episodes(parent: &Podcast) -> Result<Vec<Episode>, DataError> {
.map_err(From::from)
}
pub fn get_pd_episodes_count(parent: &Podcast) -> Result<i64, DataError> {
let db = connection();
let con = db.get()?;
Episode::belonging_to(parent)
.count()
.get_result(&con)
.map_err(From::from)
}
pub fn get_pd_episodeswidgets(parent: &Podcast) -> Result<Vec<EpisodeWidgetQuery>, DataError> {
use schema::episode::dsl::*;
let db = connection();