minor fixes
All checks were successful
ci/woodpecker/push/publish Pipeline was successful

This commit is contained in:
Mylloon 2023-04-12 01:32:42 +02:00
parent addf6e0035
commit fac3e89d1c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 14 additions and 8 deletions

View file

@ -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<Project> = Vec::new();
// Grouping PRs by projects
let mut map: HashMap<&str, Vec<Pull>> = 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

View file

@ -18,21 +18,17 @@
</p>
{{/projects}}
<h1 class="subtitle">En attente</h1>
{{#waiting}}
<p>
{{#pulls_open}}
{{#waiting}} {{#pulls_open}}
<a href="{{url}}">{{name}}#{{id}}</a>
{{/pulls_open}}
{{/pulls_open}} {{/waiting}}
</p>
{{/waiting}}
<h1 class="subtitle">Non mergées</h1>
{{#closed}}
<p>
{{#pulls_closed}}
{{#closed}} {{#pulls_closed}}
<a href="{{url}}">{{name}}#{{id}}</a>
{{/pulls_closed}}
{{/pulls_closed}} {{/closed}}
</p>
{{/closed}}
</div>
{{/error}} {{/data}} {{> footer.html }}
</body>