src/heatmap.cpp

changeset 44
de22ded6d50a
parent 16
730a5638c4ad
--- a/src/heatmap.cpp	Tue Feb 25 18:22:55 2025 +0100
+++ b/src/heatmap.cpp	Tue Feb 25 18:46:17 2025 +0100
@@ -51,3 +51,16 @@
         }]++;
     }
 }
+
+std::array<unsigned int, 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)) {
+        if (ymd.year() != year) continue;
+        result[static_cast<unsigned int>(ymd.month())-1] += commits;
+    }
+    return result;
+}

mercurial