Last active
January 17, 2018 22:14
-
-
Save therealkevinard/298e1975efd2a5592fc38b803ae3f95f to your computer and use it in GitHub Desktop.
Use detailed report view in toggl to find your avg focus-time for the day (or whatever range the report is showing)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* I just paste this in my browser console when I'm curious. Nothing fancy ;) | |
* it doesn't account for paging, which.... if it was that serious, I'd use the Toggl Api. | |
*/ | |
window.timeMetrics = (function(){ | |
//-- get seconds worked from total (at the top of detailed report, at least) | |
var parts = document.querySelector('.total-sum .duration') | |
.outerText | |
.split(':'); | |
//-- [hours, minutes, seconds] | |
var seconds = | |
(+parts[0]) * 60 * 60 + | |
(+parts[1]) * 60 + | |
(+parts[2]); | |
//-- number of task items | |
var count = document.querySelectorAll('.time-entries-list > li').length; | |
//-- math it | |
return (seconds / count) / 60; | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment