Fixed pagination page count calculation.
This commit is contained in:
parent
5a6b6c073b
commit
abda846ca3
@ -3,6 +3,7 @@ from datetime import datetime, timedelta
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import dateparser
|
import dateparser
|
||||||
import humanize
|
import humanize
|
||||||
|
import math
|
||||||
import timezonefinder
|
import timezonefinder
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
@ -370,7 +371,7 @@ async def system_list(ctx: CommandContext, system: System):
|
|||||||
current_page = 0
|
current_page = 0
|
||||||
msg: discord.Message = None
|
msg: discord.Message = None
|
||||||
while True:
|
while True:
|
||||||
page_count = len(all_members) // page_size
|
page_count = math.ceil(len(all_members) / page_size)
|
||||||
embed = embeds.member_list(await ctx.get_system(), all_members, current_page)
|
embed = embeds.member_list(await ctx.get_system(), all_members, current_page)
|
||||||
|
|
||||||
# Add reactions for moving back and forth
|
# Add reactions for moving back and forth
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import discord
|
import discord
|
||||||
|
import math
|
||||||
import humanize
|
import humanize
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
|
|
||||||
@ -219,7 +220,7 @@ def help_footer_embed() -> discord.Embed:
|
|||||||
return embed
|
return embed
|
||||||
|
|
||||||
def member_list(system: System, all_members: List[Member], current_page: int = 0, page_size: int = 10):
|
def member_list(system: System, all_members: List[Member], current_page: int = 0, page_size: int = 10):
|
||||||
page_count = len(all_members) // page_size
|
page_count = math.ceil(len(all_members) / page_size)
|
||||||
|
|
||||||
title = ""
|
title = ""
|
||||||
if len(all_members) > page_size:
|
if len(all_members) > page_size:
|
||||||
|
Loading…
Reference in New Issue
Block a user