Skip to content

Instantly share code, notes, and snippets.

@petehamilton
Last active June 5, 2017 15:15
Show Gist options
  • Save petehamilton/3cabb233695c32f3c8cf0c073d3a4fc2 to your computer and use it in GitHub Desktop.
Save petehamilton/3cabb233695c32f3c8cf0c073d3a4fc2 to your computer and use it in GitHub Desktop.
(() => {
const groups = [].slice.apply(document.querySelectorAll('.issueContainer'))
.map((node) => {
return {
link: node.querySelector('.issue-info a').getAttribute('href'),
id: node. querySelector('.issueId').textContent.trim(),
title: node.querySelector('.issue-summary').textContent.trim(),
priority: node.querySelector('[title^="Priority: "]').textContent.trim(),
type: node.querySelector('[title^="Type: "]').textContent.trim(),
};
})
.reduce((fold, item) => {
fold[item.type] = fold[item.type] || [];
fold[item.type].push(item);
return fold;
}, {});
const priorities = {
'No Priority': 0,
'No Priority Set': 0,
'Thought Needed': 0,
'Minor': 1,
'Normal': 2,
'Major': 3,
};
const result = Object.keys(groups).map((key) => {
return [
`## ${key} (${groups[key].length})`,
'| ID | Priority | Description |',
'| --- | --- | --- |',
groups[key].sort((a, b) => priorities[b.priority] - priorities[a.priority]).map((item) => {
return `| [${item.id}](${window.location.protocol}//${window.location.hostname}${item.link}) | ${'🔥'.repeat(priorities[item.priority])} | ${item.title} |`;
}).join('\n'), ''].join('\n');
}).join('\n');
console.log(result);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment