This patch aims to correct the display of "most used" software licenses.
Without sorting the collection (by decreasing order of frequency), the
`(take n)` function would only display the _n_ first items – not
necessarily the most frequent ones.
Presently, the live website
quotes the GNU Affero General Public License v3.0 (with 15.1% share) as
the most frequent license – it isn't, and somehow contradicts the bottom
chart.
Less importantly, this PR aims to improve the consistency of
the `lets` assignments in `(stats-page)`: one of them relied on a string
matching downstream ; the other on a `dissoc` ahead of clean up. We
picked the latter in both instances.
Basile Simon (2):
Bugfix: Sort "most used" licenses in decreasing order
Improve consistency of filtering out keys
src/cljs/codegouvfr/core.cljs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--
2.32.0
From: Basile Simon <basile@basilesimon.fr>
Otherwise, we (take 10) of whichever order they come in.
By chance, they appeared to be sorted before this patch.
---
src/cljs/codegouvfr/core.cljs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/cljs/codegouvfr/core.cljs b/src/cljs/codegouvfr/core.cljs
index 2047e70..c50038c 100644
--- a/src/cljs/codegouvfr/core.cljs+++ b/src/cljs/codegouvfr/core.cljs
@@ -1004,13 +1004,15 @@
(top-clean-up (walk/stringify-keys top_languages)
"language" (i/i lang [:list-repos-with-language]))
top_licenses_0
- (take 10 (top-clean-up+ (->> (top-clean-up (walk/stringify-keys
(-> top_licenses
(dissoc :Inconnue)
(dissoc :Other)))
"license"
- (i/i lang [:list-repos-using-license])))]+ (i/i lang [:list-repos-using-license]))+ (sort-by val >)+ (take 10))] [:div
[:div.fr-grid-row.fr-grid-row--center
(stats-tile lang :mean-repos-by-orga avg_repos_cnt)
--
2.32.0
[PATCH code.gouv.fr 2/2] Improve consistency of filtering out keys
Export this patch