src/heatmap.cpp

changeset 75
857af79337d5
parent 64
cfaddbb6caab
--- a/src/heatmap.cpp	Fri Feb 06 16:23:50 2026 +0100
+++ b/src/heatmap.cpp	Fri Feb 06 18:44:47 2026 +0100
@@ -68,15 +68,32 @@
     }
 }
 
-std::array<unsigned int, 12> fm::heatmap::commits_per_month(
+std::array<fm::commit_summary, 12> fm::heatmap::commits_per_month(
     const std::string& repo,
     const std::string& author,
     chrono::year year
 ) const {
-    std::array<unsigned int, 12> result{};
-    for (auto&& [ymd, commits] : m_heatmap.at(repo).at(author)) {
+    std::array<commit_summary, 12> result{};
+    for (auto &&[ymd, commits]: m_heatmap.at(repo).at(author)) {
         if (ymd.year() != year) continue;
-        result[static_cast<unsigned int>(ymd.month())-1] += commits.count();
+        commit_summary &cs = result[static_cast<unsigned int>(ymd.month()) - 1];
+        for (auto &&[reponame, summaries]: commits.summaries) {
+            cs.commits[reponame] += summaries.size();
+        }
+        for (auto &&[reponame, tags]: commits.tags) {
+            if (tags.empty()) continue;
+            std::string tag_list = tags.at(0);
+            for (unsigned i = 1; i < tags.size(); ++i) {
+                tag_list.append(", ");
+                tag_list.append(tags.at(i));
+            }
+            cs.tags_with_date[reponame].emplace_back(
+                    std::format("{} on {}-{:02}-{:02}",
+                                tag_list,
+                                static_cast<int>(ymd.year()),
+                                static_cast<unsigned>(ymd.month()),
+                                static_cast<unsigned>(ymd.day())));
+        }
     }
     return result;
 }

mercurial