From f45813195d9ff1f5e871cf5ccb258abe3be03495 Mon Sep 17 00:00:00 2001 From: Interitio Date: Sun, 20 Oct 2024 16:01:57 +1000 Subject: [PATCH] fix(profiles): Consistent account order. --- src/modules/profiles/profile.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/modules/profiles/profile.py b/src/modules/profiles/profile.py index d3ac4cd6..9703e689 100644 --- a/src/modules/profiles/profile.py +++ b/src/modules/profiles/profile.py @@ -38,7 +38,7 @@ class UserProfile: twitches = await self.twitch_accounts() if twitches: users = await self.bot.crocbot.fetch_users( - ids=[int(twitch.userid) for twitch in twitches] + ids=[int(twitches[0].userid)] ) if users: user = users[0] @@ -86,13 +86,21 @@ class UserProfile: """ Fetch the Discord accounts associated to this profile. """ - return await self.data.DiscordProfileRow.fetch_where(profileid=self.profileid) + return await self.data.DiscordProfileRow.fetch_where( + profileid=self.profileid + ).order_by( + 'created_at' + ) async def twitch_accounts(self) -> list[ProfileData.TwitchProfileRow]: """ Fetch the Twitch accounts associated to this profile. """ - return await self.data.TwitchProfileRow.fetch_where(profileid=self.profileid) + return await self.data.TwitchProfileRow.fetch_where( + profileid=self.profileid + ).order_by( + 'created_at' + ) @classmethod async def fetch(cls, bot: LionBot, profile_id: int) -> Self: