Improved achievement endpoint #268_achievements

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

View File

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

View File

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

View File

@ -41,6 +41,8 @@ class UserQuery(DataQueryWithHistoryABC):
self.set_field("discordId", self.resolve_discord_id)
self.set_field("name", self.resolve_name)
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("level", self.resolve_level)
self.add_collection(