Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculating daily work time #3

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

marekyggdrasil
Copy link

@Ruin0x11 following up on the feature suggestion #2

Please note this is a work-in-progress, more commits are going to be added to this PR. Another disclaimer is, this is my first Rust code ever so please be gentle with the review ;P.

@marekyggdrasil
Copy link
Author

@Ruin0x11 it is ready for code review, you can run it with --breakdown command line flag to see the daily work time breakout.

Feedback welcome, especially regarding coding style, it is my first Rust code after all. Also, I find the output table ugly and inefficient, I'm wondering if there is a better way to display the data.

@marekyggdrasil
Copy link
Author

@Ruin0x11 is there anything more I can do for this PR? Any feedback?

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated
@@ -504,19 +536,72 @@ fn print_results_stdout(times: &Vec<CommitHours>) -> Result<()> {
Ok(())
}

fn print_breakdown_results_stdout(times: &Vec<CommitHours>) -> Result<()> {
Copy link
Owner

@Ruin0x11 Ruin0x11 May 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it easier to have a separate function to have the breakdown results? I would prefer to have only one function with a flag or similar. I'm not too well versed in the table formatter, but I was thinking maybe you could have a conditional that adds the extra column to each row in breakdown mode. If it makes everything harder to read, I'm fine with this though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll think of a way for having a single function.

src/main.rs Show resolved Hide resolved
@Ruin0x11
Copy link
Owner

Ruin0x11 commented May 18, 2021

Sorry for the delay.

To explain, I originally made this repo for the explicit purpose of estimating how much time I had spent working on one of my other projects. I got my answer (which turned out to be around 600-700 hours) and moved on.

With this kind of motivation it's somewhat difficult for me to bring my attention back to other people if they legitimately want to help out after I've essentially accomplished all that I wanted to do with the project. I understand this is part of open sourcing and all and don't mean to make an excuse for it, since anyone is free to come and suggest things, and I don't mean to discourage others.

I decided to open source my work because I did think it might be useful to other people, and I didn't feel like keeping it to myself, but I was mainly wanting to integrate this as once facet of my larger project, and essentially, the issue of not having the tool was just "standing in the way" of me ultimately getting what I personally wanted in the end, which was the time estimate. So it maybe that was a bit selfish of me (if so, I apologize).

I think understanding that, as long as the comments I made are addressed, it should be good to merge. I'd rather merge this with a few minor changes and fix any pressing issues later than let it stagnate forever and let someone down a bit because I just never got around to responding.

So thanks for being patient.

Copy link
Owner

@Ruin0x11 Ruin0x11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also update the README.md with the usage info for the new flag?

@marekyggdrasil
Copy link
Author

I'm sorry to make you feel rushed, it was not my intention at all. Also, I want to tell you that I do understand your standpoint as my case is similar, I have this huge project and I need to know on which day how much I worked, so my approach was also very practical.

I really appreciate your comments, they are very helpful.

There is also a problem I discovered with original algorithm which is difficult to notice without breaking the work time per days.

If we consider the following example:

max_commit_diff is 1 hour
first_commit_addition is 2 hours (let us label it as a).

Then we have five days and N=5 commits, one per day, the original algorithm will iterate through pairs and increment time by first_commit_addition resulting with (N-1)*a=8 hours. The time required for one of the commits has been ignored, the true value should be N*a=10 and can be resolved by adding first_commit_addition automatically at the beginning by default.

This is what I implemented in 978000e and I believe that is correct way however it breaks the compatibility with git-hours so I do not want to force that change. Maybe we should include an additional flag to apply it?

Of course I will update the readme accordingly to reflect the new features!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants