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

db.d: count_users() with filtering by any numeric field #22

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

slook
Copy link
Contributor

@slook slook commented Sep 3, 2024

In this PR, two existing functions are repurposed to get the number of users who are privileged or banned for informational display in soulsetup, but these functions could also be, for example, to count/list all users having at least a certain amount of folders, whose speed is between a given range, or any other kind of simple lookup query that is likely to be needed.

  • Added: count_users() with filtering based on a range of minimum/maximum values of any given filter_field
  • Added: get_usernames() with filtering based on a range of minimum/maximum values of any given filter_field
  • Removed: get_all_usernames() unused function that was not referenced anywhere
  • Fixed: A couple of minor typo's and layout tweaks in the soulsetup menus, for demonstrative purposes...

Output of "Server info" in soulsetup:

Your choice : i

Soulsetup for Soulfind 0.5.0-dev (compiled on Sep  3 2024)

	2 registered users
	2 privileged users
	1 banned users

1. Recount
q. Return

Your choice : 

If the filter_field argument is omitted, then all users are counted/retrieved regardless of their min or max values. I.e. total.

If any integer filter_field is specified, then by default users are counted/retrieved whose field value is non-zero.

If a string filter_field's is specified, then the nature of the results are undefined, but in any case it is only integers that need to be supported.

@mathiascode mathiascode merged commit 6a099ff into soulfind-dev:master Sep 4, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants