Only show drills that aren't actively staking

This commit is contained in:
Joseph Ferano 2023-02-23 21:30:46 +07:00
parent 40a82ef8b6
commit 31440a9776

15
mm.py
View File

@ -71,9 +71,8 @@ def get_active_stakes(source_id):
cursor = conn.cursor()
cursor.execute("""
SELECT staking_event.id, staking_event.source_id, staking_event.well_id,
staking_event.inventory_item_id, staking_event.duration_in_mins,
staking_event.created_at
SELECT staking_event.id, source_id, well_id, inventory_item_id,
duration_in_mins, staking_event.created_at
FROM staking_event
LEFT JOIN claim_event ON staking_event.id = claim_event.staking_event_id
WHERE staking_event.source_id = ? AND claim_event.staking_event_id IS NULL;
@ -268,8 +267,14 @@ def draw_moons():
for name,(supply,ts) in wells.items():
im.text(f"{name.capitalize()}: {supply}")
items = [(item[0], world.store[item[1][0]][0]) for item in world.inventory.items()]
for item_id,item_name in items:
for item_id,(store_id,_) in world.inventory.items():
item_name = world.store[store_id][0]
skip = False
for ss in world.staking_sources[source_id][2].values():
if ss[2] == item_id:
skip = True
if skip == True:
continue
im.push_id(f"Mine{id}{name}")
if im.button(item_name):
mine(source_id, name, item_id)