Skip to content
Snippets Groups Projects

Refactor Cart into checkerboard table

Merged Mateusz Kudela requested to merge mkudela/issue-173 into develop
Compare and Show latest version
16 files
+ 144
73
Compare changes
  • Side-by-side
  • Inline
Files
16
@@ -219,20 +219,25 @@ class UpdateNodeData(CommandDataRetrieval[HarvestedDataRaw, SanitizedData, Dynam
)
def __update_manabar(self, gdpo: DynamicGlobalProperties, max_mana: int, manabar: Manabar) -> mock_database.Manabar:
power_from_api = int(manabar.current_mana)
last_update = int(manabar.last_update_time)
head_block_time = gdpo.time
head_block_timestamp = int(head_block_time.timestamp())
last_update_timestamp = manabar.last_update_time
power_from_api = manabar.current_mana
max_mana_value = vests_to_hive(max_mana, gdpo)
mana_value = vests_to_hive(
calculate_current_manabar_value(
now=int(gdpo.time.timestamp()),
now=head_block_timestamp,
max_mana=max_mana,
current_mana=power_from_api,
last_update_time=last_update,
last_update_time=last_update_timestamp,
),
gdpo,
)
full_regeneration = self.__get_manabar_regeneration_time(
gdpo_time=gdpo.time, max_mana=max_mana, current_mana=power_from_api, last_update_time=last_update
head_block_time=head_block_time,
max_mana=max_mana,
current_mana=power_from_api,
last_update_time=last_update_timestamp,
)
return mock_database.Manabar(
@@ -242,18 +247,19 @@ class UpdateNodeData(CommandDataRetrieval[HarvestedDataRaw, SanitizedData, Dynam
)
def __get_manabar_regeneration_time(
self, gdpo_time: datetime, max_mana: int, current_mana: int, last_update_time: int
self, head_block_time: datetime, max_mana: int, current_mana: int, last_update_time: int
) -> timedelta:
if max_mana <= 0:
return timedelta(0)
head_block_timestamp = int(head_block_time.timestamp())
return (
calculate_manabar_full_regeneration_time(
now=int(gdpo_time.timestamp()),
now=head_block_timestamp,
max_mana=max_mana,
current_mana=current_mana,
last_update_time=last_update_time,
)
- gdpo_time
- head_block_time
)
def __get_account(self, name: str) -> Account:
Loading