You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@attic.apache.org by se...@apache.org on 2025/10/06 10:16:40 UTC
(attic) branch main updated: Simplify by using map and join
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/attic.git
The following commit(s) were added to refs/heads/main by this push:
new a676131 Simplify by using map and join
a676131 is described below
commit a676131322ec0edc003b7b0ec50b97d1a4e2b97a
Author: Sebb <se...@apache.org>
AuthorDate: Mon Oct 6 11:16:32 2025 +0100
Simplify by using map and join
---
stats.md | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/stats.md b/stats.md
index 313d43d..55ba311 100644
--- a/stats.md
+++ b/stats.md
@@ -30,7 +30,7 @@ The following graph shows the number of Projects retiring for each year (**NOT**
{% assign sorted_years = site.data.years_array | sort: 'year' -%}
{% assign no_of_years = 20 -%}
{% assign first = sorted_years | size | minus: no_of_years | at_least: 0 -%}
-{% assign second = first | plus: 1 -%}
+{% assign p_counts = sorted_years | map: "p_count" %}
{% assign count_max = 0 -%}
{%- for year in sorted_years offset: first -%}
{% assign count_max = count_max | at_least: year['p_count'] -%}
@@ -39,21 +39,12 @@ The following graph shows the number of Projects retiring for each year (**NOT**
```mermaid
xychart-beta
title "Project Retirements by Year"
- x-axis "Year" [{{ sorted_years[first]['year']}}
- {%- for year in sorted_years offset: second -%}
- {{ year['year'] | prepend: ', '}}
- {%- endfor %}]
+ x-axis "Year" [{{ sorted_years | map: "year" | join: ', ' }}]
y-axis "Number of Projects" 0 --> {{count_max | plus: 2 | at_least: 10}}
- bar [{{ sorted_years[first]['p_count']}}
- {%- for year in sorted_years offset: second -%}
- {{ year['p_count'] | prepend: ', '}}
- {%- endfor %}]
- line [{{ sorted_years[first]['p_count']}}
- {%- for year in sorted_years offset: second -%}
- {{ year['p_count'] | prepend: ', '}}
- {%- endfor %}]
+ bar [{{ p_counts | join: ', ' }}]
+ line [{{ p_counts | join: ', ' }}]
```
{: .note}
-This is currently configured to show the last **{{ no_of_years}} years** of retirements (easily changed through the `$no_of_years` variable).
+This is currently configured to show the last **{{ no_of_years}} years** of retirements (easily changed through the `no_of_years` variable).