46 | std::views::transform([](auto r) { return std::string_view(r); }) |
46 | std::views::transform([](auto r) { return std::string_view(r); }) |
47 | std::ranges::to<std::vector>(); |
47 | std::ranges::to<std::vector>(); |
48 std::from_chars(date_parts[0].begin(), date_parts[0].end(), year); |
48 std::from_chars(date_parts[0].begin(), date_parts[0].end(), year); |
49 std::from_chars(date_parts[1].begin(), date_parts[1].end(), month); |
49 std::from_chars(date_parts[1].begin(), date_parts[1].end(), month); |
50 std::from_chars(date_parts[2].begin(), date_parts[2].end(), day); |
50 std::from_chars(date_parts[2].begin(), date_parts[2].end(), day); |
51 m_heatmap[m_current_repo][author][chrono::year_month_day{ |
51 auto &[summaries] = m_heatmap[m_current_repo][author][chrono::year_month_day{ |
52 chrono::year{year}, chrono::month{month}, chrono::day{day} |
52 chrono::year{year}, chrono::month{month}, chrono::day{day} |
53 }]++; |
53 }]; |
|
54 ++parts_iter; |
|
55 summaries.emplace_back(std::string_view{*parts_iter}); |
54 } |
56 } |
55 } |
57 } |
56 |
58 |
57 std::array<unsigned int, 12> fm::heatmap::commits_per_month( |
59 std::array<unsigned int, 12> fm::heatmap::commits_per_month( |
58 const std::string& repo, |
60 const std::string& repo, |
60 chrono::year year |
62 chrono::year year |
61 ) const { |
63 ) const { |
62 std::array<unsigned int, 12> result{}; |
64 std::array<unsigned int, 12> result{}; |
63 for (auto&& [ymd, commits] : m_heatmap.at(repo).at(author)) { |
65 for (auto&& [ymd, commits] : m_heatmap.at(repo).at(author)) { |
64 if (ymd.year() != year) continue; |
66 if (ymd.year() != year) continue; |
65 result[static_cast<unsigned int>(ymd.month())-1] += commits; |
67 result[static_cast<unsigned int>(ymd.month())-1] += commits.count(); |
66 } |
68 } |
67 return result; |
69 return result; |
68 } |
70 } |