Skip to content

Instantly share code, notes, and snippets.

@peterfication
Created July 3, 2017 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterfication/648930840edcf5c56b8ab03afad631e5 to your computer and use it in GitHub Desktop.
Save peterfication/648930840edcf5c56b8ab03afad631e5 to your computer and use it in GitHub Desktop.
// Analyze asana task export in JS console
// Format of a task title has to be "[estimated amount of time] title (Actual time used for the task)"
// It prints out the average deviation of the estimated time
// Open the export JSON in Chrome and run this script in the browser console
if (typeof(x) === 'undefined') {
const x = JSON.parse($('pre').innerHTML)
}
var differences = []
for (let task of x.data) {
var name = task.name
if (name.startsWith('[') && name.endsWith(')')) {
const estimated = parseFloat(name.substring(1, name.indexOf(']')))
const actual = parseFloat(name.substring(name.lastIndexOf('(') + 1, name.lastIndexOf(')')))
const difference = estimated - actual
// console.log(task.name, estimated, actual, difference)
differences.push(difference)
}
}
// console.log(differences)
var sum = differences.reduce(function(a, b) { return a + b })
var avg = sum / differences.length
console.log(avg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment