From 1fe4d495a6c45dfb8526fcb7db2d978204275a8e Mon Sep 17 00:00:00 2001 From: Flamki <9833ayush@gmail.com> Date: Sun, 22 Feb 2026 21:02:16 +0530 Subject: [PATCH 1/3] Add automated community metrics to community page --- .github/workflows/update-discourse-data.yml | 2 + assets/data/community-metrics.json | 60 +++++++ content/community/community.md | 9 ++ js/community-metrics.js | 166 ++++++++++++++++++++ tools/fetch-community-metrics.py | 154 ++++++++++++++++++ 5 files changed, 391 insertions(+) create mode 100644 assets/data/community-metrics.json create mode 100644 js/community-metrics.js create mode 100644 tools/fetch-community-metrics.py diff --git a/.github/workflows/update-discourse-data.yml b/.github/workflows/update-discourse-data.yml index 1a822541c0b..0931a3d1cc5 100644 --- a/.github/workflows/update-discourse-data.yml +++ b/.github/workflows/update-discourse-data.yml @@ -32,6 +32,7 @@ jobs: run: | python tools/fetch-news.py python tools/fetch-faq.py + python tools/fetch-community-metrics.py - name: Configure Git author run: | @@ -42,6 +43,7 @@ jobs: run: | git add assets/data/news.json git add assets/data/faq.json + git add assets/data/community-metrics.json git commit -m "Update Discourse data data [skip ci]" || echo "No changes to commit" - name: Push commit diff --git a/assets/data/community-metrics.json b/assets/data/community-metrics.json new file mode 100644 index 00000000000..4a0e0582012 --- /dev/null +++ b/assets/data/community-metrics.json @@ -0,0 +1,60 @@ +{ + "generated_at": "2026-02-22T15:31:13.791892+00:00", + "github": { + "repositories": [ + { + "id": "core", + "label": "preCICE core", + "full_name": "precice/precice", + "url": "https://github.com/precice/precice", + "description": "A coupling library and ecosystem for partitioned multi-physics and multi-scale simulations, including surface and volume coupling.", + "stars": 887, + "forks": 224, + "open_issues": 230, + "watchers": 35, + "contributors": 66, + "latest_commit_at": "2026-02-18T13:23:28Z", + "latest_release": { + "name": "v3.3.1", + "tag_name": "v3.3.1", + "published_at": "2026-01-14T15:28:58Z", + "url": "https://github.com/precice/precice/releases/tag/v3.3.1", + "assets_count": 8, + "downloads_count": 345 + } + }, + { + "id": "tutorials", + "label": "Tutorials", + "full_name": "precice/tutorials", + "url": "https://github.com/precice/tutorials", + "description": "Various tutorial cases for the coupling library preCICE with real solvers. These files are meant to be rendered on precice.org, so don't look at the README files here.", + "stars": 131, + "forks": 138, + "open_issues": 110, + "watchers": 10, + "contributors": 48, + "latest_commit_at": "2026-02-20T20:01:02Z", + "latest_release": { + "name": "v202404.0 - Now with preCICE v3", + "tag_name": "v202404.0", + "published_at": "2024-04-16T20:35:04Z", + "url": "https://github.com/precice/tutorials/releases/tag/v202404.0", + "assets_count": 0, + "downloads_count": 0 + } + } + ] + }, + "discourse": { + "url": "https://precice.discourse.group", + "title": "preCICE Forum on Discourse", + "site_creation_date": "2019-09-16T04:29:48.122Z", + "users_count": 676, + "topics_count": 1163, + "posts_count": 8866, + "active_users_30_days": 62, + "topics_30_days": 18, + "posts_30_days": 83 + } +} \ No newline at end of file diff --git a/content/community/community.md b/content/community/community.md index d340619d90d..57a9ef53414 100644 --- a/content/community/community.md +++ b/content/community/community.md @@ -21,6 +21,15 @@ Meet the community online, ask questions, and help others at the [preCICE forum Are you looking for something else? Maybe one of the other [community channels](community-channels.html) is for you. +## Community metrics + +The following metrics are updated automatically and provide a quick snapshot of community activity. + +
+Loading automatically generated metrics...
+ + + ## Support preCICE There are different ways how to support preCICE and get priority support from the preCICE developers in return. [Find out which options](community-support-precice.html). diff --git a/js/community-metrics.js b/js/community-metrics.js new file mode 100644 index 00000000000..3a2e25e27f7 --- /dev/null +++ b/js/community-metrics.js @@ -0,0 +1,166 @@ +console.log("community-metrics.js loaded"); + +(function () { + function formatNumber(value) { + if (typeof value !== "number") { + return "n/a"; + } + return new Intl.NumberFormat("en-US").format(value); + } + + function formatDate(value) { + if (!value) { + return "n/a"; + } + + var parsed = new Date(value); + if (Number.isNaN(parsed.getTime())) { + return "n/a"; + } + + return parsed.toLocaleDateString("en-US", { + year: "numeric", + month: "short", + day: "numeric", + }); + } + + function createItem(label, value) { + return "" + description + "
" : ""; + var linkHtml = ""; + if (linkUrl && linkLabel) { + linkHtml = + ""; + } + + card.innerHTML = + "Loading automatically generated metrics...
-Loading automatically generated metrics...
diff --git a/js/community-metrics.js b/js/community-metrics.js index 3a2e25e27f7..48674f36091 100644 --- a/js/community-metrics.js +++ b/js/community-metrics.js @@ -1,6 +1,9 @@ -console.log("community-metrics.js loaded"); - (function () { + var REPO_BLURBS = { + core: "Core coupling library and ecosystem.", + tutorials: "Ready-to-run tutorial cases for users and developers.", + }; + function formatNumber(value) { if (typeof value !== "number") { return "n/a"; @@ -31,17 +34,18 @@ console.log("community-metrics.js loaded"); function createCardColumn(title, description, items, linkUrl, linkLabel) { var column = document.createElement("div"); - column.className = "col-md-4 col-sm-6 col-flex"; + column.className = "col-md-12"; var card = document.createElement("div"); - card.className = "panel panel-primary panel-precice full-height"; + card.className = "panel panel-primary panel-precice"; + card.style.marginBottom = "14px"; - var list = "" + description + "
" : ""; + var list = "" + description + "
" : ""; var linkHtml = ""; if (linkUrl && linkLabel) { linkHtml = - "" +
linkLabel +
@@ -52,7 +56,7 @@ console.log("community-metrics.js loaded");
" " + description + "" + items.join("") + "
";
- var descriptionHtml = description ? "