@@ -279,7 +279,14 @@ _.extend(
279279 } ) . then ( ( { count } ) => count ) ;
280280 } ,
281281 _getResults (
282- { skip, limit, selectUserKeys, includeStatistics, version } ,
282+ {
283+ skip,
284+ limit,
285+ selectUserKeys,
286+ includeUserKeys,
287+ includeStatistics,
288+ version,
289+ } ,
283290 authOptions ,
284291 userId
285292 ) {
@@ -291,8 +298,13 @@ _.extend(
291298 query : {
292299 skip,
293300 limit,
294- includeUser : selectUserKeys
295- ? ensureArray ( selectUserKeys ) . join ( ',' )
301+ selectUserKeys :
302+ _ . union (
303+ ensureArray ( selectUserKeys ) ,
304+ ensureArray ( includeUserKeys )
305+ ) . join ( ',' ) || undefined ,
306+ includeUser : includeUserKeys
307+ ? ensureArray ( includeUserKeys ) . join ( ',' )
296308 : undefined ,
297309 includeStatistics : includeStatistics
298310 ? ensureArray ( includeStatistics ) . join ( ',' )
@@ -322,18 +334,33 @@ _.extend(
322334 * @param {Object } [options]
323335 * @param {number } [options.skip] The number of results to skip. This is useful for pagination.
324336 * @param {number } [options.limit] The limit of the number of results.
325- * @param {string[] } [options.selectUserKeys] Specify keys of the users to include
337+ * @param {string[] } [options.selectUserKeys] Specify keys of the users to include in the Rankings
338+ * @param {string[] } [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
326339 * @param {string[] } [options.includeStatistics] Specify other statistics to include in the Rankings
327340 * @param {number } [options.version] Specify the version of the leaderboard
328341 * @param {AuthOptions } [authOptions]
329342 * @return {Promise<Ranking[]> }
330343 */
331344 getResults (
332- { skip, limit, selectUserKeys, includeStatistics, version } = { } ,
345+ {
346+ skip,
347+ limit,
348+ selectUserKeys,
349+ includeUserKeys,
350+ includeStatistics,
351+ version,
352+ } = { } ,
333353 authOptions
334354 ) {
335355 return this . _getResults (
336- { skip, limit, selectUserKeys, includeStatistics, version } ,
356+ {
357+ skip,
358+ limit,
359+ selectUserKeys,
360+ includeUserKeys,
361+ includeStatistics,
362+ version,
363+ } ,
337364 authOptions
338365 ) ;
339366 } ,
@@ -342,7 +369,8 @@ _.extend(
342369 * @param {AV.User } user The specified AV.User pointer.
343370 * @param {Object } [options]
344371 * @param {number } [options.limit] The limit of the number of results.
345- * @param {string[] } [options.selectUserKeys] Specify keys of the users to include
372+ * @param {string[] } [options.selectUserKeys] Specify keys of the users to include in the Rankings
373+ * @param {string[] } [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
346374 * @param {string[] } [options.includeStatistics] Specify other statistics to include in the Rankings
347375 * @param {number } [options.version] Specify the version of the leaderboard
348376 * @param {AuthOptions } [authOptions]
@@ -353,9 +381,15 @@ _.extend(
353381 if ( user && typeof user . id !== 'string' ) {
354382 return this . getResultsAroundUser ( undefined , user , options ) ;
355383 }
356- const { limit, selectUserKeys, includeStatistics, version } = options ;
384+ const {
385+ limit,
386+ selectUserKeys,
387+ includeUserKeys,
388+ includeStatistics,
389+ version,
390+ } = options ;
357391 return this . _getResults (
358- { limit, selectUserKeys, includeStatistics, version } ,
392+ { limit, selectUserKeys, includeUserKeys , includeStatistics, version } ,
359393 authOptions ,
360394 user ? user . id : 'self'
361395 ) ;
0 commit comments