Skip to content

Commit

Permalink
fix param structure to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura Gerhardt committed Mar 14, 2016
1 parent 9a323e0 commit e0a51de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/cardrecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ method.run = function(callback){
if (hasMoved && daysSinceUpdate < 1) {
console.log("Write New Phase: "+card["name"]);
var lastPhase = classThis.getLastList(card.actions[0]);
classThis.compileCommentArtifact(card["id"], lastPhase, lastPhase, card.actions[1].date, card.actions[0].date, callback, true);
classThis.compileCommentArtifact(card["id"], lastPhase, lastPhase, card.actions[1].date, card.actions[0].date, true, callback);
} else {
console.log("Write Current Phase: "+card["name"]);
classThis.getListNameByID(card["idList"]).then(function(listName){
classThis.compileCommentArtifact(card["id"], listName, "Current", card.actions[0].date, now.format(), callback, true);
classThis.compileCommentArtifact(card["id"], listName, "Current", card.actions[0].date, now.format(), true, callback);
});
}
});
Expand Down Expand Up @@ -93,14 +93,14 @@ method.getLastList = function(cardAction){
}

//Run function to build a comment
method.compileCommentArtifact = function(cardID, dateList, nameList, fromDate, toDate, callback, addComment){
method.compileCommentArtifact = function(cardID, dateList, nameList, fromDate, toDate, addCommentOpt, callback){
var stage = _un.findWhere(classThis.Stages, {name: dateList});
var expectedTime = stage["expected_time"];
var diffArray = this.calculateDateDifference(expectedTime, fromDate, toDate);
var differenceFromExpected = diffArray[0];
var timeTaken = diffArray[1];
var comment = this.buildComment(differenceFromExpected, expectedTime, fromDate, toDate, nameList, timeTaken);
if(addComment) {
if(addCommentOpt) {
this.addComment(comment, cardID).then(callback);
} else {
callback(comment);
Expand Down
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ if ("b" in argv) {
console.log("--Build a Comment--");
var file = (argv["b"]=== true) ? 'data/stages.yaml' : argv["d"];
var CR = new app.CardRecorder(file, board);
CR.compileCommentArtifact(null, argv.d, argv.d, argv.f, argv.t, console.log, false);
CR.compileCommentArtifact(null, argv.d, argv.d, argv.f, argv.t, false, console.log);
}
2 changes: 1 addition & 1 deletion test/test-card-recorder.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ describe 'app.CardRecorder', ->
sandbox.restore()
return
it 'will run the date diff functions, build and post a comment', (done) ->
CR.compileCommentArtifact 'xxxx', 'Workshop Prep', 'Workshop Prep', '2016-04-05T10:40:26.100Z', '2016-07-27T10:40:26.100Z', ->
CR.compileCommentArtifact 'xxxx', 'Workshop Prep', 'Workshop Prep', '2016-04-05T10:40:26.100Z', true, '2016-07-27T10:40:26.100Z', ->
expect(addComment.calledWith('**Workshop Prep Stage:** `+103 days`. *04/05/2016 - 07/27/2016*.\n Expected days: 10 days. Actual Days spent: 113.')).to.be.ok
expect(addComment.callCount).to.equal 1
done()
Expand Down

0 comments on commit e0a51de

Please sign in to comment.