Last active
December 27, 2015 14:29
-
-
Save serby/7341085 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // List all tasks with no labels | |
| (function () { | |
| if (document.location.host !== 'www.pivotaltracker.com') { | |
| return alert('This should be run in a console within "www.pivotaltracker.com"') | |
| } | |
| var projectId = document.location.pathname.match(/\d+/)[0] | |
| , teams = ['frontend', 'backend', 'creative', 'technical services'] | |
| $.get('https://www.pivotaltracker.com/services/v5/projects/' + projectId + '/stories?limit=999999', function(results) { | |
| var out = {} | |
| results.forEach(function (data) { | |
| // Ignore Iceboxed stories | |
| if (data.current_state === 'unscheduled') return | |
| data.labels.forEach(function (label) { | |
| // Only show team | |
| if (teams.indexOf(label.name) === -1) return | |
| if (!out[label.name]) { | |
| out[label.name] = | |
| { count: 0 | |
| , sum: 0 | |
| } | |
| } | |
| out[label.name].count += 1 | |
| out[label.name].sum += data.estimate || 0 | |
| }) | |
| }) | |
| console.log('%cLabel | Count | Sum ', 'font-weight: bold') | |
| var labels = Object.keys(out) | |
| , totals = { count: 0, sum: 0 } | |
| labels.sort() | |
| labels.forEach(function (label) { | |
| var value = out[label] | |
| console.log(pad(label, 50) + '|' + rpad(value.count, 10) + '|' + rpad(value.sum, 10)) | |
| totals.count += value.count | |
| totals.sum += value.sum | |
| }) | |
| console.log('%c' + pad('Totals', 50) + '|' + rpad(totals.count, 10) + '|' + rpad(totals.sum, 10), 'color: blue; font-weight: bold') | |
| }) | |
| })() | |
| function pad(value, length, c) { | |
| c = c || ' ' | |
| var str = '' + value | |
| while (str.length < length) { | |
| str = str + c | |
| } | |
| return str | |
| } | |
| function rpad(value, length, c) { | |
| c = c || ' ' | |
| var str = '' | |
| value += '' | |
| while (str.length + value.length < length) { | |
| str = str + c | |
| } | |
| return str + value | |
| } |
This file contains hidden or 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
| // List all tasks with no labels | |
| (function () { | |
| if (document.location.host !== 'www.pivotaltracker.com') { | |
| return alert('This should be run in a console within "www.pivotaltracker.com"') | |
| } | |
| var projectId = document.location.pathname.match(/\d+/)[0] | |
| , teams = ['frontend', 'backend', 'creative', 'technical services'] | |
| $.get('https://www.pivotaltracker.com/services/v5/projects/' + projectId + '/stories?limit=999999', function(results) { | |
| results.forEach(function (data) { | |
| var notInTeam = teams.every(function (team) { | |
| return data.labels.map(getLabel).indexOf(team) === -1 | |
| }) | |
| if (isNotAssignedTeam(data, teams)) { | |
| console.log(data.name, data.labels.map(getLabel)) | |
| } | |
| }) | |
| }) | |
| })() | |
| function isNotAssignedTeam(data, teams) { | |
| return teams.every(function (team) { | |
| return data.labels.map(getLabel).indexOf(team) === -1 | |
| }) | |
| } | |
| function getLabel(obj) { | |
| return obj.name | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment