-
Notifications
You must be signed in to change notification settings - Fork 13
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
Issue 16 part2 #18
Issue 16 part2 #18
Conversation
// ***************************** | ||
|
||
function getStats(resource, parameters) { | ||
return new Promise(function(resolve, reject) { |
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.
I didn't want to introduce another dependency so I simply wrapped existing request into new promise.
Promise required for async downloading of stats for all languages that the user solved the puzzle with.
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.
cgstats run in a nodejs 8+. Don't worry for Promise :p
@@ -126,37 +126,74 @@ app.get('/search*', function(req, res) { | |||
}); | |||
}); | |||
} else if (optimizations.indexOf(game) != -1) { | |||
getStats('LeaderboardsRemoteService/getFilteredPuzzleLeaderboard', | |||
[game, , , {"active" : true, "column" : "keyword", "filter" : player}]) | |||
.then(function (response) { |
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.
this response contains rankings only for requested keyword, like
{ users:
[ { pseudo: 'd-s-x',
rank: 63,
globalRank: 63,
localRank: 63,
score: 100,
testSessionHandle: '48277672d595cdc4b03e02abca6bda19f64a5cb',
programmingLanguage: 'Bash',
inProgress: false,
criteriaScore: 38,
company: '',
codingamer: [Object] },
{ pseudo: 'd-s-x',
rank: 64,
globalRank: 64,
localRank: 64,
score: 100,
testSessionHandle: '48277672d595cdc4b03e02abca6bda19f64a5cb',
programmingLanguage: 'Perl',
inProgress: false,
criteriaScore: 38,
company: '',
codingamer: [Object] },
{ pseudo: 'd-s-x',
rank: 221,
globalRank: 221,
localRank: 221,
score: 100,
testSessionHandle: '48277672d595cdc4b03e02abca6bda19f64a5cb',
programmingLanguage: 'Ruby',
inProgress: false,
criteriaScore: 50,
company: '',
codingamer: [Object] },
...
so we have to download more stats but with language filter instead
This restores points calculation for optimization puzzles (code golf).
The issue is that in previous pull-request only rankings for current user were returned from cg server and as result the user always got 200 points.
This PR implements puzzle stats downloading for all languages that user solved the puzzle with.