src/heatmap.h

changeset 81
1ff88eb9555c
parent 75
857af79337d5
equal deleted inserted replaced
80:fa5f493adfb5 81:1ff88eb9555c
43 std::string, // author 43 std::string, // author
44 std::map< 44 std::map<
45 std::chrono::year_month_day, // date 45 std::chrono::year_month_day, // date
46 commits 46 commits
47 >>> m_heatmap; 47 >>> m_heatmap;
48 std::map<
49 std::string, // dummy string - so that both maps have the same type
50 std::map<
51 std::string, // author
52 std::map<
53 std::chrono::year_month_day, // date
54 commits
55 >>> m_aggregated_heatmap;
48 std::string m_current_repo; 56 std::string m_current_repo;
49 bool m_separate; 57
58 static constexpr auto aggregated_repo_label = "All Repositories";
50 public: 59 public:
51 explicit heatmap(bool separate) noexcept : m_separate(separate) {}
52
53 void set_repo(const std::string& repo) { 60 void set_repo(const std::string& repo) {
54 m_current_repo.assign(repo); 61 m_current_repo.assign(repo);
55 } 62 }
56 void add(const settings &settings, const std::string& log); 63 void add(const settings &settings, const std::string& log);
57 64
58 [[nodiscard]] const auto& data() const { 65 [[nodiscard]] const auto& separated() const {
59 return m_heatmap; 66 return m_heatmap;
67 }
68
69 [[nodiscard]] const auto& aggregated() const {
70 return m_aggregated_heatmap;
60 } 71 }
61 72
62 [[nodiscard]] std::array<commit_summary, 12> commits_per_month( 73 [[nodiscard]] std::array<commit_summary, 12> commits_per_month(
63 const std::string &repo, 74 const std::string &repo,
64 const std::string& author, 75 const std::string& author,

mercurial