Last active
March 20, 2017 21:39
-
-
Save timaschew/ddea277d8f5b1b167877adb90c9dee28 to your computer and use it in GitHub Desktop.
Calculates the story points on a trello board and replaces the list title (origin list title MUST NOT have whitespaces)
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
(function() { | |
function parsePoints(e) { | |
const text = $(e).find(".badge-text").text(); | |
const tmp = text.split(' '); | |
if (tmp[0].trim().toLowerCase() === 'points:') { | |
return parseInt(tmp[1]); | |
} | |
return 0; | |
} | |
$(".js-list-content").each((i, board) => { | |
const cards = $(board).find(".js-plugin-badges"); | |
const points = 0; | |
cards.each((j, card) => { | |
points += parsePoints(card); | |
}); | |
const origin = $(board).find(".list-header-name.mod-list-name.js-list-name-input").text(); | |
const text = origin.split(' ')[0]; | |
$(board).find(".list-header-name.mod-list-name.js-list-name-input").text(text + ' ' + points + 'P'); | |
}); | |
})(); |
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
javascript:(function() { function parsePoints(e) { const text = $(e).find(".badge-text").text(); const tmp = text.split(' '); if (tmp[0].trim().toLowerCase() === 'points:') { return parseInt(tmp[1]); } return 0; } $(".js-list-content").each((i, board) => { const cards = $(board).find(".js-plugin-badges"); let points = 0; cards.each((j, card) => { points += parsePoints(card); }); const origin = $(board).find(".list-header-name.mod-list-name.js-list-name-input").text(); const text = origin.split(' ')[0]; $(board).find(".list-header-name.mod-list-name.js-list-name-input").text(text + ' (' + points + 'P)'); });})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment