Added streaks and updated deps

master v1.4.0
Wynd 2025-08-30 17:47:22 +03:00
parent e608cd9958
commit a748f78a94
3 changed files with 636 additions and 403 deletions

997
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -21,24 +21,19 @@ bench = false
unsafe_code = { level = "forbid" }
[dependencies]
gix = { version = "0.70.0", default-features = false, features = [
gix = { version = "0.73", default-features = false, features = [
"mailmap",
"parallel",
] }
clap = { version = "4.5.32", features = ["derive"] }
chrono = { version = "0.4.40" }
itertools = { version = "0.14.0" }
anyhow = { version = "1.0.95" }
rayon = { version = "1.10.0" }
clap = { version = "4.5", features = ["derive"] }
chrono = { version = "0.4" }
itertools = { version = "0.14" }
anyhow = { version = "1.0" }
rayon = { version = "1.11" }
[dev-dependencies]
divan = { version = "0.1.17" }
mockd = { version = "0.4.35", features = [
"datetime",
"words",
"name",
"contact",
] }
divan = { version = "0.1" }
mockd = { version = "0.4", features = ["datetime", "words", "name", "contact"] }
[[bench]]
name = "commits"

View File

@ -18,6 +18,8 @@ pub struct Heatmap {
branches: usize,
repos: usize,
chunks: Vec<Chunk>,
streak: u32,
max_streak: u32,
format: Format,
list_repos: bool,
@ -69,6 +71,8 @@ impl Heatmap {
let mut chunk = Chunk::new(day_of_week);
let mut chunk_idx = 0;
let mut streak = 0;
let mut max_streak = 0;
// Track the very first day of the heatmap, as we don't want the extra spacing in front of
// those.
@ -108,12 +112,18 @@ impl Heatmap {
let value = grouped_commits.get(&current_day);
match value {
Some(val) => {
streak += 1;
if streak > max_streak {
max_streak = streak;
}
chunk.data[day_of_week as usize].push(*val);
if *val > highest_count {
highest_count = *val;
}
}
None => {
streak = 0;
chunk.data[day_of_week as usize].push(0);
}
}
@ -135,6 +145,9 @@ impl Heatmap {
branches,
repos,
chunks,
streak,
max_streak,
format,
list_repos,
list_days,
@ -180,6 +193,14 @@ impl Display for Heatmap {
writeln!(f, " {}: {} {}", repo, repo_commits, commits_label).unwrap();
}
}
writeln!(
f,
"{} current streak | {} longest streak",
self.streak, self.max_streak
)
.unwrap();
writeln!(f).unwrap();
let mut per_day_commits: [i32; 7] = [0, 0, 0, 0, 0, 0, 0];