cx_leaderboard v0.1.0 CxLeaderboard.Indexer.Stats View Source

This module is full of functions that can be used in a custom indexer. Each uses a different way of calculating stats. Do you want your ranks to go sequentially, like 1, 1, 2? Then choose one of the sequential_rank_* functions. Want them offset instead, like 1, 1, 3? Choose one of the offset_rank_* functions. If there is something else you want to do that isn’t available here, you are welcome to implement your own function.

Most of the functions here are meant to be given as on_rank callback. See description of each function to find out whether it’s intended for on_rank or on_entry.

The functions used by default are:

on_rank: &Stats.offset_rank_1_99_less_or_equal_percentile/1
on_entry: &Stats.global_index/1

Link to this section Summary

Functions

An on_entry function. Provides the global index in the leaderboard for each record

An on_rank function. Calculates ranks with an offset (e.g. 1,1,3) and percentiles based on all lower scores and equal scores, then squeezes the percentile into 1-99 range

An on_rank function. Calculates ranks with an offset (e.g. 1,1,3) and percentiles based on all lower and equal scores

An on_rank function. Calculates ranks with an offset (e.g. 1,1,3) and percentiles based on all lower scores

An on_rank function. Calculates ranks with an offset (e.g. 1,1,3) and percentiles based on all lower scores, and half the equal scores

An on_rank function. Calculates ranks sequentially (e.g. 1,1,2) and percentiles based on all lower scores and equal scores, then squeezes the percentile into 1-99 range

An on_rank function. Calculates ranks sequentially (e.g. 1,1,2) and percentiles based on all lower and equal scores

An on_rank function. Calculates ranks sequentially (e.g. 1,1,2) and percentiles based on all lower scores

An on_rank function. Calculates ranks sequentially (e.g. 1,1,2) and percentiles based on all lower scores, and half the equal scores

Link to this section Functions

An on_entry function. Provides the global index in the leaderboard for each record.

This is the default choice.

Link to this function offset_rank_1_99_less_or_equal_percentile(arg) View Source

An on_rank function. Calculates ranks with an offset (e.g. 1,1,3) and percentiles based on all lower scores and equal scores, then squeezes the percentile into 1-99 range.

This is the default choice.

Link to this function offset_rank_less_than_or_equal_percentile(arg) View Source

An on_rank function. Calculates ranks with an offset (e.g. 1,1,3) and percentiles based on all lower and equal scores.

Link to this function offset_rank_less_than_percentile(arg) View Source

An on_rank function. Calculates ranks with an offset (e.g. 1,1,3) and percentiles based on all lower scores.

Link to this function offset_rank_midpoint_percentile(arg) View Source

An on_rank function. Calculates ranks with an offset (e.g. 1,1,3) and percentiles based on all lower scores, and half the equal scores.

Link to this function sequential_rank_1_99_less_or_equal_percentile(arg) View Source

An on_rank function. Calculates ranks sequentially (e.g. 1,1,2) and percentiles based on all lower scores and equal scores, then squeezes the percentile into 1-99 range.

Link to this function sequential_rank_less_than_or_equal_percentile(arg) View Source

An on_rank function. Calculates ranks sequentially (e.g. 1,1,2) and percentiles based on all lower and equal scores.

Link to this function sequential_rank_less_than_percentile(arg) View Source

An on_rank function. Calculates ranks sequentially (e.g. 1,1,2) and percentiles based on all lower scores.

Link to this function sequential_rank_midpoint_percentile(arg) View Source

An on_rank function. Calculates ranks sequentially (e.g. 1,1,2) and percentiles based on all lower scores, and half the equal scores.