Skip to content

Commit

Permalink
[ACHIEVEMENT] Added member achievement (#40)
Browse files Browse the repository at this point in the history
* added member achievement

* changed pullRequest.author to pullRequest.creator

* fixed image extension

* added pullrequest number to achievement title

* fixed time to wait :-)
  • Loading branch information
ortichon committed Jan 27, 2017
1 parent 3b0676c commit c482393
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions achievements/member.achievement.js
@@ -0,0 +1,31 @@
var moment = require('moment');

var member = {
name: 'Member?',
check: function(pullRequest, shall) {
if (isWaitingLongTime(pullRequest)) {

var achieve = {
avatar : 'images/achievements/member.achievement.jpg',
name : 'Member pull request #' + pullRequest.number + '?',
short : 'Member Commits? member Push? member PR? ohh I member',
description : [
'A pull request you\'ve created 2 weeks ago',
' is finally merged'
].join(''),
relatedPullRequest: pullRequest.id
};

shall.grant(pullRequest.creator.username, achieve);
}
}
};

function isWaitingLongTime(pullRequest) {
var backThen = moment(pullRequest.createdOn);
var now = moment();

return now.diff(backThen, 'weeks') > 2;
}

module.exports = member;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c482393

Please sign in to comment.