1.1.0 #352

Merged
edraft merged 145 commits from 1.1.0 into master 2023-08-24 17:50:25 +02:00
2 changed files with 10 additions and 1 deletions
Showing only changes of commit a71e3e4720 - Show all commits

View File

@ -44,3 +44,7 @@ class AchievementAttributeResolver:
def get_played_on_game_server(self, user: User) -> List[str]:
joins = self._user_joined_game_server.get_user_joined_game_servers_by_user_id(user.id)
return joins.select(lambda x: x.game_server.name)
def get_last_ontime_hours(self, user: User) -> int:
ujvs = self._user_joined_voice_channels.get_user_joined_voice_channels_by_user_id(user.id)
return int(str(ujvs.max(lambda join: (join.leaved_on - join.joined_on).total_seconds() / 3600)))

View File

@ -48,7 +48,9 @@ class AchievementService:
AchievementAttribute(
"played_on_game_server", lambda user: resolver.get_played_on_game_server(user), "GameServer"
),
AchievementAttribute("last_single_ontime_hours", lambda user: user.level, "GameServer"),
AchievementAttribute(
"last_single_ontime_hours", lambda user: resolver.get_last_ontime_hours(user), "number"
),
]
)
@ -62,6 +64,9 @@ class AchievementService:
"contains": lambda value, expected_value: expected_value in value,
}
def add_achievement_attribute(self, atr: AchievementAttribute):
self._attributes.add(atr)
def get_operators(self) -> list[str]:
return [x for x in self._operators.keys()]