diff --git a/src/routes/contrib.rs b/src/routes/contrib.rs
index 8470e70..b1102cf 100644
--- a/src/routes/contrib.rs
+++ b/src/routes/contrib.rs
@@ -45,6 +45,8 @@ pub async fn get_page(config: Config) -> std::string::String {
let data = match fetch_pr().await {
Ok(projects) => {
let mut data: Vec = Vec::new();
+
+ // Grouping PRs by projects
let mut map: HashMap<&str, Vec> = HashMap::new();
projects.iter().for_each(|p| {
let project = Pull {
@@ -68,6 +70,7 @@ pub async fn get_page(config: Config) -> std::string::String {
}
});
+ // Distributes each PR in the right vector
data.iter_mut().for_each(|d| {
map.get(d.name.as_str()).unwrap().iter().for_each(|p| {
let state = p.state.into();
@@ -82,6 +85,13 @@ pub async fn get_page(config: Config) -> std::string::String {
d.name = name.into_iter().collect();
});
+ // Ascending order
+ data.iter_mut().for_each(|d| {
+ d.pulls_closed.reverse();
+ d.pulls_merged.reverse();
+ d.pulls_open.reverse();
+ });
+
PortfolioTemplate {
error: false,
projects: data
diff --git a/templates/contrib.html b/templates/contrib.html
index 7206729..70c6441 100644
--- a/templates/contrib.html
+++ b/templates/contrib.html
@@ -18,21 +18,17 @@
{{/projects}}
En attente
- {{#waiting}}
- {{#pulls_open}}
+ {{#waiting}} {{#pulls_open}}
{{name}}#{{id}}
- {{/pulls_open}}
+ {{/pulls_open}} {{/waiting}}
- {{/waiting}}
Non mergées
- {{#closed}}
- {{#pulls_closed}}
+ {{#closed}} {{#pulls_closed}}
{{name}}#{{id}}
- {{/pulls_closed}}
+ {{/pulls_closed}} {{/closed}}
- {{/closed}}
{{/error}} {{/data}} {{> footer.html }}