Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
fix: rank top offset argument (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlsf authored May 14, 2024
1 parent 815def8 commit fb9ba8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ class RankCommand : AbstractRootCommand() {
}

override suspend fun execute(context: Context<InteractionResponseBehavior>) {
var offset = context.args.optionalInt("offset") ?: 0
var offset = context.args.optionalLong("offset") ?: 0
var invalidOffset = false
var maxOffset = 0
var maxOffset = 0L
if (offset < 0) offset = 0
if (offset != 0) {
if (offset != 0L) {
newSuspendedTransaction {
maxOffset = DatabaseDevCordUser.all().count().toInt()
maxOffset = DatabaseDevCordUser.all().count()
if (maxOffset <= offset) {
invalidOffset = true
offset = if (maxOffset < 10) {
Expand All @@ -137,7 +137,7 @@ class RankCommand : AbstractRootCommand() {
}

val users = newSuspendedTransaction {
DatabaseDevCordUser.all().limit(10, offset.toLong())
DatabaseDevCordUser.all().limit(10, offset)
.orderBy(Users.level to SortOrder.DESC, Users.experience to SortOrder.DESC)
.mapIndexed { index, it ->
val name =
Expand Down

0 comments on commit fb9ba8c

Please sign in to comment.