Count items in database as much as possible (#344)
* Count items in database as much as possible * Fix the tests * Remove two useless queries * Run pragma directive before each sqlite connection * Pragma for tests too * Remove debug messages
This commit is contained in:
+2
-2
@@ -66,8 +66,8 @@ pub fn details(blog: String, slug: String, conn: DbConn, user: Option<User>, res
|
||||
Tag::for_post(&*conn, post.id),
|
||||
comments.into_iter().filter(|c| c.in_response_to_id.is_none()).collect::<Vec<Comment>>(),
|
||||
previous,
|
||||
post.get_likes(&*conn).len(),
|
||||
post.get_reshares(&*conn).len(),
|
||||
post.count_likes(&*conn),
|
||||
post.count_reshares(&*conn),
|
||||
user.clone().map(|u| u.has_liked(&*conn, &post)).unwrap_or(false),
|
||||
user.clone().map(|u| u.has_reshared(&*conn, &post)).unwrap_or(false),
|
||||
user.map(|u| u.is_following(&*conn, post.get_authors(&*conn)[0].id)).unwrap_or(false),
|
||||
|
||||
Reference in New Issue
Block a user