diff options
Diffstat (limited to 'pkgs/by-name/ba/back/src/web/mod.rs')
-rw-r--r-- | pkgs/by-name/ba/back/src/web/mod.rs | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/pkgs/by-name/ba/back/src/web/mod.rs b/pkgs/by-name/ba/back/src/web/mod.rs index 1e6a5af..35dc59f 100644 --- a/pkgs/by-name/ba/back/src/web/mod.rs +++ b/pkgs/by-name/ba/back/src/web/mod.rs @@ -39,20 +39,25 @@ pub fn issue_list_boilerplate( ) -> error::Result<RawHtml<String>> { let repository = &config.repository; - let issue_list = issues_from_repository(&repository.to_thread_local())? + let mut issue_list = issues_from_repository(&repository.to_thread_local())? .into_iter() - .fold(String::new(), |acc, val| { - let issue = val.collaps(); + .map(|issue| issue.collapse()) + .collect::<Vec<CollapsedIssue>>(); - format!("{}{}", acc, { - if issue.status == wanted_status { - let issue_entry = issue.to_list_entry(); - issue_entry.0 - } else { - String::new() - } - }) - }); + // Sort by date descending. + issue_list.sort_by_key(|issue| unsafe { issue.timestamp.to_unsafe() }); + issue_list.reverse(); + + let issue_list_str = issue_list.into_iter().fold(String::new(), |acc, issue| { + format!("{}{}", acc, { + if issue.status == wanted_status { + let issue_entry = issue.to_list_entry(); + issue_entry.0 + } else { + String::new() + } + }) + }); let counter_status_lower = counter_status.to_string().to_lowercase(); Ok(RawHtml(format!( @@ -81,7 +86,7 @@ pub fn issue_list_boilerplate( --> </div> <ol class="issue-list"> - {issue_list} + {issue_list_str} </ol> </main> </div> |