fix (stats): Order profile tags.
This commit is contained in:
@@ -539,21 +539,21 @@ class StatsData(Registry):
|
|||||||
_timestamp = Timestamp()
|
_timestamp = Timestamp()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def fetch_tags(self, guildid: Optional[int], userid: int):
|
async def fetch_tags(cls, guildid: Optional[int], userid: int):
|
||||||
tags = await self.fetch_where(guildid=guildid, userid=userid)
|
tags = await cls.fetch_where(guildid=guildid, userid=userid).order_by(cls.tagid)
|
||||||
if not tags and guildid is not None:
|
if not tags and guildid is not None:
|
||||||
tags = await self.fetch_where(guildid=None, userid=userid)
|
tags = await cls.fetch_where(guildid=None, userid=userid)
|
||||||
return [tag.tag for tag in tags]
|
return [tag.tag for tag in tags]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@log_wrap(action='set_profile_tags')
|
@log_wrap(action='set_profile_tags')
|
||||||
async def set_tags(self, guildid: Optional[int], userid: int, tags: Iterable[str]):
|
async def set_tags(cls, guildid: Optional[int], userid: int, tags: Iterable[str]):
|
||||||
async with self._connector.connection() as conn:
|
async with cls._connector.connection() as conn:
|
||||||
self._connector.conn = conn
|
cls._connector.conn = conn
|
||||||
async with conn.transaction():
|
async with conn.transaction():
|
||||||
await self.table.delete_where(guildid=guildid, userid=userid)
|
await cls.table.delete_where(guildid=guildid, userid=userid)
|
||||||
if tags:
|
if tags:
|
||||||
await self.table.insert_many(
|
await cls.table.insert_many(
|
||||||
('guildid', 'userid', 'tag'),
|
('guildid', 'userid', 'tag'),
|
||||||
*((guildid, userid, tag) for tag in tags)
|
*((guildid, userid, tag) for tag in tags)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user