src/heatmap.cpp

changeset 44
de22ded6d50a
parent 16
730a5638c4ad
equal deleted inserted replaced
43:f58fd8461e10 44:de22ded6d50a
49 m_heatmap[m_current_repo][author][chrono::year_month_day{ 49 m_heatmap[m_current_repo][author][chrono::year_month_day{
50 chrono::year{year}, chrono::month{month}, chrono::day{day} 50 chrono::year{year}, chrono::month{month}, chrono::day{day}
51 }]++; 51 }]++;
52 } 52 }
53 } 53 }
54
55 std::array<unsigned int, 12> fm::heatmap::commits_per_month(
56 const std::string& repo,
57 const std::string& author,
58 chrono::year year
59 ) const {
60 std::array<unsigned int, 12> result{};
61 for (auto&& [ymd, commits] : m_heatmap.at(repo).at(author)) {
62 if (ymd.year() != year) continue;
63 result[static_cast<unsigned int>(ymd.month())-1] += commits;
64 }
65 return result;
66 }

mercurial