mirror of
https://github.com/arcan1s/ffxivbis.git
synced 2025-04-25 01:37:17 +00:00
better properties naming
This commit is contained in:
parent
000457a77e
commit
082022dee7
@ -2,7 +2,7 @@
|
||||
include = ffxivbis.ini.d
|
||||
logging = ffxivbis.ini.d/logging.ini
|
||||
database = sqlite
|
||||
priority = is_required loot_count_bis loot_count_total loot_count loot_priority
|
||||
priority = is_required loot_count_bis loot_priority loot_count loot_count_total
|
||||
|
||||
[web]
|
||||
host = 0.0.0.0
|
||||
|
@ -54,7 +54,7 @@ class LootSuggestHtmlView(LootBaseView, PlayerBaseView):
|
||||
'suggest': [
|
||||
{
|
||||
'player': player.pretty_name,
|
||||
'loot_count_bis': player.loot_count_total_bis,
|
||||
'loot_count_bis': player.loot_count_bis,
|
||||
'loot_count': player.loot_count,
|
||||
}
|
||||
for player in players
|
||||
|
@ -38,7 +38,7 @@ class PlayerHtmlView(PlayerBaseView):
|
||||
{
|
||||
'job': player.job.name,
|
||||
'nick': player.nick,
|
||||
'loot_count_bis': player.loot_count_total_bis,
|
||||
'loot_count_bis': player.loot_count_bis,
|
||||
'loot_count': player.loot_count,
|
||||
'priority': player.priority
|
||||
}
|
||||
|
@ -43,13 +43,13 @@ class UsersHtmlView(LoginBaseView):
|
||||
|
||||
try:
|
||||
action = data.get('action')
|
||||
username = data.get('username')
|
||||
username = str(data.get('username'))
|
||||
|
||||
if action == 'add':
|
||||
required = ['password', 'permission']
|
||||
if any(param not in data for param in required):
|
||||
return wrap_invalid_param(required, data)
|
||||
await self.create_user(username, data.get('password'), data.get('permission'))
|
||||
await self.create_user(username, data.get('password'), data.get('permission')) # type: ignore
|
||||
elif action == 'remove':
|
||||
await self.remove_user(username)
|
||||
else:
|
||||
|
@ -45,7 +45,7 @@ class PlayerIdWithCounters(PlayerId):
|
||||
loot_count: int
|
||||
loot_count_bis: int
|
||||
loot_count_total: int
|
||||
loot_count_total_bis: int
|
||||
bis_count_total: int
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -70,7 +70,7 @@ class Player:
|
||||
def player_id_with_counters(self, piece: Union[Piece, Upgrade, None]) -> PlayerIdWithCounters:
|
||||
return PlayerIdWithCounters(self.job, self.nick, self.priority,
|
||||
abs(self.loot_count(piece)), abs(self.loot_count_bis(piece)),
|
||||
abs(self.loot_count_total(piece)), abs(self.loot_count_total_bis(piece)))
|
||||
abs(self.loot_count_total(piece)), abs(self.bis_count_total(piece)))
|
||||
|
||||
# ordering methods
|
||||
def is_required(self, piece: Union[Piece, Upgrade, None]) -> bool:
|
||||
@ -94,15 +94,13 @@ class Player:
|
||||
return -self.loot_count_total(piece)
|
||||
return -self.loot.count(piece)
|
||||
|
||||
def loot_count_bis(self, piece: Union[Piece, Upgrade, None]) -> int:
|
||||
if piece is None:
|
||||
return -self.loot_count_total_bis(piece)
|
||||
def loot_count_bis(self, _: Union[Piece, Upgrade, None]) -> int:
|
||||
return -len([piece for piece in self.loot if self.bis.has_piece(piece)])
|
||||
|
||||
def loot_count_total(self, _: Union[Piece, Upgrade, None]) -> int:
|
||||
return -len(self.loot)
|
||||
|
||||
def loot_count_total_bis(self, _: Union[Piece, Upgrade, None]) -> int:
|
||||
def bis_count_total(self, _: Union[Piece, Upgrade, None]) -> int:
|
||||
return len([piece for piece in self.bis.pieces if not piece.is_tome])
|
||||
|
||||
def loot_priority(self, _: Union[Piece, Upgrade, None]) -> int:
|
||||
|
@ -16,17 +16,17 @@ def test_loot_count(player: Player, head_with_upgrade: Piece, weapon: Piece) ->
|
||||
|
||||
|
||||
def test_loot_count_bis(player: Player, head_with_upgrade: Piece, weapon: Piece) -> None:
|
||||
assert abs(player.loot_count_total_bis(head_with_upgrade)) == 0
|
||||
assert abs(player.loot_count_total_bis(weapon)) == 0
|
||||
assert abs(player.bis_count_total(head_with_upgrade)) == 0
|
||||
assert abs(player.bis_count_total(weapon)) == 0
|
||||
|
||||
player.bis.set_item(head_with_upgrade)
|
||||
player.loot.append(head_with_upgrade)
|
||||
assert abs(player.loot_count_total_bis(head_with_upgrade)) == 0
|
||||
assert abs(player.loot_count_total_bis(weapon)) == 0
|
||||
assert abs(player.bis_count_total(head_with_upgrade)) == 0
|
||||
assert abs(player.bis_count_total(weapon)) == 0
|
||||
|
||||
player.bis.set_item(weapon)
|
||||
assert abs(player.loot_count_total_bis(head_with_upgrade)) == 1
|
||||
assert abs(player.loot_count_total_bis(weapon)) == 1
|
||||
assert abs(player.bis_count_total(head_with_upgrade)) == 1
|
||||
assert abs(player.bis_count_total(weapon)) == 1
|
||||
|
||||
|
||||
def test_loot_count_total(player: Player, head_with_upgrade: Piece, weapon: Piece) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user