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:
Baptiste Gelez
2018-12-14 23:16:18 +01:00
committed by GitHub
parent b0089e59b7
commit 38302203f4
19 changed files with 109 additions and 60 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ pub fn follow_auth(name: String, i18n: I18n) -> Flash<Redirect> {
pub fn followers(name: String, conn: DbConn, account: Option<User>, page: Option<Page>, intl: I18n) -> Result<Ructe, Ructe> {
let page = page.unwrap_or_default();
let user = User::find_by_fqn(&*conn, &name).ok_or_else(|| render!(errors::not_found(&(&*conn, &intl.catalog, account.clone()))))?;
let followers_count = user.get_followers(&*conn).len(); // TODO: count in DB
let followers_count = user.count_followers(&*conn);
Ok(render!(users::followers(
&(&*conn, &intl.catalog, account.clone()),