Sort incidents
This commit is contained in:
@@ -22,7 +22,9 @@ pub(super) async fn get_incident_page(
|
|||||||
session: &Session,
|
session: &Session,
|
||||||
page_index: usize,
|
page_index: usize,
|
||||||
) -> Result<MessageBuilder<State, Extras>, DatabaseError> {
|
) -> Result<MessageBuilder<State, Extras>, DatabaseError> {
|
||||||
let incidents = UserIncident::get_for_user(user_id, session).await?;
|
let mut incidents = UserIncident::get_for_user(user_id, session).await?;
|
||||||
|
|
||||||
|
incidents.sort_by(|a, b| b.created_at.cmp(&a.created_at));
|
||||||
|
|
||||||
if let Some(incident) = incidents.get(page_index) {
|
if let Some(incident) = incidents.get(page_index) {
|
||||||
Ok(MessageBuilder::new()
|
Ok(MessageBuilder::new()
|
||||||
|
|||||||
Reference in New Issue
Block a user