From 274a6d567b4467f1c8c37fd4601dc297f4a444b6 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 14 Apr 2023 12:00:16 +0200 Subject: [PATCH] sort by nb of contrib --- src/routes/contrib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/routes/contrib.rs b/src/routes/contrib.rs index 9a8992e..105307d 100644 --- a/src/routes/contrib.rs +++ b/src/routes/contrib.rs @@ -85,13 +85,21 @@ pub async fn get_page(config: Config) -> String { d.name = name.into_iter().collect(); }); - // Ascending order + // Ascending order by pulls IDs data.iter_mut().for_each(|d| { d.pulls_closed.reverse(); d.pulls_merged.reverse(); d.pulls_open.reverse(); }); + // Ascending order by number of pulls + data.sort_by(|a, b| { + b.pulls_merged + .len() + .partial_cmp(&a.pulls_merged.len()) + .unwrap() + }); + PortfolioTemplate { error: false, projects: Some(