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