Reorder reports
This commit is contained in:
parent
ff780d8d4d
commit
81316a9426
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Reference in New Issue