Improved achievement endpoint #268_achievements

This commit is contained in:
Sven Heidemann 2023-07-12 22:34:00 +02:00
parent dda2e2f5f6
commit 2578c47c44
3 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,10 @@ class Achievement(TableABC):
self._id = id self._id = id
self._name = name self._name = name
self._attribute = attribute self._attribute = attribute
if operator not in ["==", "!=", "<=", ">=", "<", ">"]:
raise ValueError("operator must be ==,!=,<=,>=,< or >")
self._operator = operator self._operator = operator
self._value = value self._value = value
self._server = server self._server = server

View File

@ -3,6 +3,8 @@ type User implements TableWithHistoryQuery {
discordId: String discordId: String
name: String name: String
xp: Int xp: Int
messageCount: Int
reactionCount: Int
ontime: Float ontime: Float
level: Level level: Level

View File

@ -41,6 +41,8 @@ class UserQuery(DataQueryWithHistoryABC):
self.set_field("discordId", self.resolve_discord_id) self.set_field("discordId", self.resolve_discord_id)
self.set_field("name", self.resolve_name) self.set_field("name", self.resolve_name)
self.set_field("xp", self.resolve_xp) self.set_field("xp", self.resolve_xp)
self.set_field("messageCount", lambda x, *_: x.message_count)
self.set_field("reactionCount", lambda x, *_: x.reaction_count)
self.set_field("ontime", self.resolve_ontime) self.set_field("ontime", self.resolve_ontime)
self.set_field("level", self.resolve_level) self.set_field("level", self.resolve_level)
self.add_collection( self.add_collection(