Skip to content

Instantly share code, notes, and snippets.

@jhubert

jhubert/about.md Secret

Last active August 29, 2015 14:00
Show Gist options
  • Save jhubert/8eec558ab8cea9fd4aaa to your computer and use it in GitHub Desktop.
Save jhubert/8eec558ab8cea9fd4aaa to your computer and use it in GitHub Desktop.
This is a simple JavaScript based addition to Waffle.io that includes velocity points on the board based on the contents of the git issue title.

Waffle Velocity Scores

This is a simple set of JS and CSS that renders velocity scores based on the content of the GitHub issue title.

To run it, just copy the JavaScript and paste it in the chrome JS console.

The CSS needs to be added to the page in order to render properly. I used the LiveCSSEditor chrome plugin to just inject the CSS when writing this.

Screenshot

License

       DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
                Version 2, December 2004 

Copyright (C) 2014 Jeremy Baker jhubert@gmail.com

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. You just DO WHAT THE FUCK YOU WANT TO.
function sumScores(scores) {
var total = 0;
$.each(scores, function () {
var v = $(this).text();
if (v != '?') {
total += parseInt(v, 10);
}
});
return total;
}
function extractScore(t) {
var score, matches = t.match(/(?:^|\s)\(([\d]+)\)(?:$|\s)/);
return matches ? matches[1] : '?';
}
function updateCardScore(card, score) {
var footer = card.find('.footer');
if (footer.find('.score').length) {
footer.find('.score strong').text(score);
} else {
footer.append('<div class="score"><strong>' + score + '</strong> <i class="fa fa-lightbulb-o"></i></div>');
}
}
function updateColumnTotal(column, total) {
var header = column.find('.column-header');
if (header.find('.total-score').length) {
header.find('.total-score strong').text(total);
} else {
header.append('<span class="total-score"><strong>' + total + '</strong> <i class="fa fa-lightbulb-o"></i></span>');
}
}
function processCardScore() {
var t = $(this).find('.title').val();
updateCardScore($(this), extractScore(t));
}
function tallyColumn() {
updateColumnTotal($(this), sumScores($(this).find('.footer .score strong')));
}
jQuery('.card-body').each(processCardScore);null
jQuery('.column-ct').each(tallyColumn);null
.board .card .card-body .footer .score { position: absolute; right: 20px; bottom: 4px; color: #fff; font-size: 14px; padding: 0 5px; background-color: #62B4F8; border-radius: 3px; }
.board .board-body .column-ct .column .column-header .total-score { color: #fff; margin-left: 10px; padding: 0 5px; background-color: #62B4F8; border-radius: 3px; vertical-align: top; line-height: 30px; display: inline-block; margin-top: 5px; height: 28px; }
@rockerhieu
Copy link

I been switching from JIRA to waffle.io and struggling at applying SCRUM with it. Thanks for the useful script. I also ported this script to Chrome Extension so we don't need to execute this script from the developer console every time we want to update the result: https://github.com/rockerhieu/waffle.io-velocity-scores

@jhubert
Copy link
Author

jhubert commented Jul 28, 2014

awesome. Thanks @rockerhieu. Glad you found it useful. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment