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

Added support for getting leaderboard size back with position #4433

Open
wants to merge 15 commits into
base: V3/develop
Choose a base branch
from

Conversation

MrBillson
Copy link

@MrBillson MrBillson commented Sep 17, 2020

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Added support for getting leaderboard size back with position. You can now pass in an optional param that is a flag to return the overall leaderboard size or not. This is the enhancement requested in issue 4200. This is a backwards compatible non-breaking change.

closes #4200

Copy link
Contributor

@Drapersniper Drapersniper left a comment

Choose a reason for hiding this comment

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

Just a quick initial review from my phone, also I noticed something like 578 states the return type in an int, that's incorrect since it's an Optional[int], would you mind tweaking that while working on this pr? If not it's fine it can be done in a separate PR.

You will notice I've renamed some of the variables you have added, this is to ensure we are following PEP and keeping variable naming motion consistent across the project.

redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
redbot/core/bank.py Outdated Show resolved Hide resolved
@Jackenmen Jackenmen added Category: Core - API - Bank This is related to the core Bank API. Type: Enhancement Something meant to enhance existing Red features. labels Sep 19, 2020
MrBillson and others added 11 commits September 19, 2020 13:29
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
@MrBillson
Copy link
Author

Great feedback. I have a better idea on contributing to this project now!

@MrBillson MrBillson closed this Sep 19, 2020
@Drapersniper Drapersniper reopened this Sep 19, 2020
Added Tuple import from typing
Ran make reformat to fix style
@MrBillson
Copy link
Author

I think all of the requested changes are done. Let me know if not. Thanks!

@Jackenmen Jackenmen added this to the 3.4.6 milestone Dec 26, 2020
@Jackenmen Jackenmen modified the milestones: 3.4.6, 3.4.7 Jan 17, 2021
@Drapersniper Drapersniper self-assigned this May 31, 2021
Copy link
Contributor

@Drapersniper Drapersniper left a comment

Choose a reason for hiding this comment

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

This is awkward, I forgot to assign it to me so I missed your changed, Approving for now.

@jack1142 this one is on the milestone for 3.4.11, but just in case merging would make your life harder, please go ahead and merge when it is a good time.

@@ -559,27 +559,36 @@ async def get_leaderboard(positions: int = None, guild: discord.Guild = None) ->


async def get_leaderboard_position(
member: Union[discord.User, discord.Member]
) -> Union[int, None]:
member: Union[discord.User, discord.Member], return_lb_size: bool = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
member: Union[discord.User, discord.Member], return_lb_size: bool = False
member: Union[discord.User, discord.Member], *, return_lb_size: bool = False

Jack suggested this should be changed into a keyword-only arg, so if you can do this too it would be awesome.

Copy link
Contributor

@Drapersniper Drapersniper left a comment

Choose a reason for hiding this comment

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

Once the pending suggestion is addressed I can merge this one for you @MrBillson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core - API - Bank This is related to the core Bank API. Type: Enhancement Something meant to enhance existing Red features.
Projects
None yet
4 participants