Skip to content

Commit

Permalink
mark: moving grid creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mneedham committed Sep 3, 2011
1 parent f1560e7 commit e972676
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function parseCommitsFromRepository(fn) {
gitEntries.split('\n').forEach(function(item) {
if(item != "") {
var theSplit = item.split('|');
if(theSplit !== undefined && theSplit[1] !== undefined) {
if(theSplit !== undefined && theSplit[1] !== undefined && theSplit[2] !== undefined) {
var date = theSplit[1].trim().split(" ")[0]*1000;
commits.push({message: theSplit[2].trim(), date: new Date(date).toDateString(), time : new Date(date).toTimeString()})
} else {
Expand Down
14 changes: 12 additions & 2 deletions static/pairs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ function Pairs(data) {
return maxPairCount;
}

return { grid : pairs, mostPairings : mostPairings, totals : totals
};
function drawGrid() {
var pairingGrid = PairingGrid();
pairingGrid.addHeading(["Person", "Times Paired", "Number of Commits", "Commits per pairing", "Last paired"]);
$.each(parsePairs(), function(person, options) {
pairingGrid.addRow([person, options.timesPaired, options.numberOfCommits, (options.numberOfCommits/options.timesPaired).toFixed(2), options.lastPaired]);
});
pairingGrid.addRow(["Total", totals.timesPaired, totals.commits, totals.commitsPerPairing, "-"])
return pairingGrid.draw();
}


return { grid : pairs, mostPairings : mostPairings, totals : totals, drawGrid : drawGrid };
}
10 changes: 2 additions & 8 deletions views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,15 @@ script
var pairs = Pairs(data);
var pairCount = pairs.grid;
var maxPairCount = pairs.mostPairings();

var pairingGrid = PairingGrid();
pairingGrid.addHeading(["Person", "Times Paired", "Number of Commits", "Commits per pairing", "Last paired"])

var timesPaired = "";

$.each(pairCount, function(person, options) {
var fontSize = (options.timesPaired / maxPairCount) * 100;
timesPaired += "<span style='font-size:" + fontSize + "px; padding:4px;'>" + person + "</span> ";
pairingGrid.addRow([person, options.timesPaired, options.numberOfCommits, (options.numberOfCommits/options.timesPaired).toFixed(2), options.lastPaired]);
});

pairingGrid.addRow(["Total", pairs.totals.timesPaired, pairs.totals.commits, pairs.totals.commitsPerPairing, "-"])

$("#timespaired").html(timesPaired);
$("#whotheypairedwith").html(pairingGrid.draw());
$("#whotheypairedwith").html(pairs.drawGrid());
});

});
Expand Down

0 comments on commit e972676

Please sign in to comment.