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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ACHIEVEMENT] The Gladiator - achievement for getting all the reaction to a comment #51
Conversation
@dunaevsky opened PR #52 so you'll have the data you want. you can review that one first so you'll have the data available to work in this branch |
Also added a data example in |
@dunaevsky let me know when you finish all your changes and I'll start reviewing. |
@ortichon @thatkookooguy I'ma put a pin on it for tonight and pick up tomorrow sometime, Since there's 2 features to add. If you have suggestions for the "short" and "description" it will be great. |
@dunaevsky Cool. Just add the help wanted label so we'll know this is not up for review yet and just brainstorming |
@thatkookooguy Already have 3 labels since this was my goal here from the get go |
Here's how I made a function that gives back all comments (or pull request) creators that got all 6 reactions: function getCommentAuthorsWithAllReactions(pullRequest) {
var allComments = _.concat(pullRequest.comments, pullRequest.inlineComments);
var authors = _.map(allComments, 'author.username');
var AllCommentsReactions = _.map(allComments, 'reactions');
// also add pull request description reactions
authors.push(pullRequest.creator.username);
AllCommentsReactions.push(pullRequest.reactions);
getOnlyUniqueReactionsWithoutAuthors(AllCommentsReactions, authors);
return onlyUsersWithAllReactions(authors, AllCommentsReactions);
}
function reactionsWithoutAuthor(reactions, author) {
return _.map(_.reject(reactions, ['user.username', author]), 'reaction');
}
function getOnlyUniqueReactionsWithoutAuthors(AllCommentsReactions, authors) {
_.forEach(AllCommentsReactions, function(reactions, index) {
AllCommentsReactions[index] =
_.uniq(reactionsWithoutAuthor(reactions, authors[index]));
});
}
function onlyUsersWithAllReactions(authors, AllCommentsReactions) {
var commentAuthorsWithAllReactions = [];
_.forEach(authors, function(author, index) {
if (AllCommentsReactions[index].length === 6) {
commentAuthorsWithAllReactions.push(author);
}
});
return commentAuthorsWithAllReactions;
} I try and remove all the data that I don't need so that data would be easier to understand.
So, when you call getCommentAuthorsWithAllReactions(pullRequest)
// ["dunaevsky", "Thatkookooguy"] |
Notice that I don't use _.forEach(undefined, function(dog) { return console.log('woof') });
_.forEach([], function(dog) { return console.log('woof') });
// both print nothing Since all |
@dunaevsky - So, make the function work and let's start the review. Please test the achievement (if you already got the achievement in the DB, delete it to test you get it again). Also, test it after you took the latest changes from you can use Then, make sure that inside the This will fix all common mistakes automatically for you when you save the file, and show you errors for things you need to fix manually. restart |
@thatkookooguy cool. I'll go over it. But gonna have to postpone it again |
This is not including inline comments Yet. Also, I've noticed there is no collection of reactions for the PR itself. Can we? The name will change. Also not sure about the beatles.
Can't distinguish between when trying to eliminate self reactions. Also granting to creator is not set yet
d95a998
to
c6c1ea5
Compare
I did it for the memberberry :* |
var achievement = { | ||
avatar: 'images/achievements/gladiator.achievement.gif', | ||
name: 'Gladiator', | ||
short: 'Are You Not Entertained?', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E is uppercase
I think a ?!
can work here
name: 'Gladiator', | ||
short: 'Are You Not Entertained?', | ||
description: [ | ||
'You got all the reactions to your comment. You make everybody feel.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you like this description? seems kind of too non-descriptive to me
The commenter gets the achievement.
-It still does not work for inline comments
-You can also add reactions to the PR itself, I wanted to give an achievement to the creator also, but I didn't see it being audited. @thatkookooguy LMKWYT
-I am uncertain about the name, so would like suggestions
-Big up and much 馃憤 to @ortichon who helped me de-bug this shit