| 66 tags[m_current_repo].emplace_back(tags_view); |
66 tags[m_current_repo].emplace_back(tags_view); |
| 67 } |
67 } |
| 68 } |
68 } |
| 69 } |
69 } |
| 70 |
70 |
| 71 std::array<unsigned int, 12> fm::heatmap::commits_per_month( |
71 std::array<fm::commit_summary, 12> fm::heatmap::commits_per_month( |
| 72 const std::string& repo, |
72 const std::string& repo, |
| 73 const std::string& author, |
73 const std::string& author, |
| 74 chrono::year year |
74 chrono::year year |
| 75 ) const { |
75 ) const { |
| 76 std::array<unsigned int, 12> result{}; |
76 std::array<commit_summary, 12> result{}; |
| 77 for (auto&& [ymd, commits] : m_heatmap.at(repo).at(author)) { |
77 for (auto &&[ymd, commits]: m_heatmap.at(repo).at(author)) { |
| 78 if (ymd.year() != year) continue; |
78 if (ymd.year() != year) continue; |
| 79 result[static_cast<unsigned int>(ymd.month())-1] += commits.count(); |
79 commit_summary &cs = result[static_cast<unsigned int>(ymd.month()) - 1]; |
| |
80 for (auto &&[reponame, summaries]: commits.summaries) { |
| |
81 cs.commits[reponame] += summaries.size(); |
| |
82 } |
| |
83 for (auto &&[reponame, tags]: commits.tags) { |
| |
84 if (tags.empty()) continue; |
| |
85 std::string tag_list = tags.at(0); |
| |
86 for (unsigned i = 1; i < tags.size(); ++i) { |
| |
87 tag_list.append(", "); |
| |
88 tag_list.append(tags.at(i)); |
| |
89 } |
| |
90 cs.tags_with_date[reponame].emplace_back( |
| |
91 std::format("{} on {}-{:02}-{:02}", |
| |
92 tag_list, |
| |
93 static_cast<int>(ymd.year()), |
| |
94 static_cast<unsigned>(ymd.month()), |
| |
95 static_cast<unsigned>(ymd.day()))); |
| |
96 } |
| 80 } |
97 } |
| 81 return result; |
98 return result; |
| 82 } |
99 } |