1
0
Fork 0

Reorder reports

This commit is contained in:
Alex Kotov 2020-10-22 10:18:49 +05:00
parent ff780d8d4d
commit 81316a9426
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ pub struct Report {
}
impl Report {
pub fn all(db_conn: DbConn) -> Result<Vec<Self>, diesel::result::Error> {
reports::table.load::<Self>(&*db_conn)
pub fn all_desc(db_conn: DbConn) -> Result<Vec<Self>, diesel::result::Error> {
reports::table.order(reports::datetime.desc()).load::<Self>(&*db_conn)
}
}

View File

@ -17,7 +17,7 @@ pub fn index(
csrf_token: CsrfToken,
current_user: states::MaybeCurrentUser,
) -> Result<Template, CommonResponse> {
let reports = models::Report::all(db_conn)?;
let reports = models::Report::all_desc(db_conn)?;
let page_context = views::reports::Index {
reports,