mirror of
https://github.com/atuinsh/atuin.git
synced 2025-02-02 11:39:43 +01:00
Fix wrapped command if not full year
If atuin has not been used the whole year, then the "Command Evolution" will be misleading, as the year is split 182 days after the first command. This change set the mid-point of the year midways between the first and last command in the year.
This commit is contained in:
parent
05aec6f8d6
commit
05cfc8fc61
@ -89,7 +89,11 @@ impl WrappedStats {
|
||||
|
||||
// Error analysis
|
||||
let mut command_errors: HashMap<String, (usize, usize)> = HashMap::new(); // (total_uses, errors)
|
||||
let midyear = history[0].timestamp + Duration::days(182); // Split year in half
|
||||
|
||||
// Find number of days commands have been collected
|
||||
let days =
|
||||
(history[history.len() - 1].timestamp.ordinal() - history[0].timestamp.ordinal()) / 2;
|
||||
let midyear = history[0].timestamp + Duration::days(days.into()); // Split year in half
|
||||
|
||||
let mut first_half_commands: HashMap<String, usize> = HashMap::new();
|
||||
let mut second_half_commands: HashMap<String, usize> = HashMap::new();
|
||||
|
Loading…
Reference in New Issue
Block a user