Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACHIEVEMENT] Added member achievement #40

Merged
merged 5 commits into from Jan 27, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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?',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you want to add the pull request in the name?

like: 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, 'minutes') > 5;
}

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