From e115b52db5526e58b322363e39b862fd03236835 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Thu, 23 Feb 2023 20:37:53 +0700 Subject: [PATCH] Put the queries in their own file --- data.sql | 36 ------------------------------------ mm.py | 3 +-- queries.sql | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 38 deletions(-) create mode 100644 queries.sql diff --git a/data.sql b/data.sql index ef63dbf..50570be 100644 --- a/data.sql +++ b/data.sql @@ -12,7 +12,6 @@ INSERT INTO users(name) VALUES ('Plug'), ('Upgrade'); - INSERT INTO bank_account(user_id, resource_id, balance) VALUES (1, 1, 200), (1, 2, 175), @@ -26,38 +25,3 @@ INSERT INTO store_item(name, currency, target_resource, price, claim_amount) VAL ('Drill 1C', 1, 3, 25, 500), ('Drill 1D', 1, 4, 25, 500), ('Drill 1E', 1, 5, 25, 500); - -SELECT staking_event.id,well_id,staking_event.source_id, - inventory_item_id,staking_event.created_at,expiration_at -FROM staking_event -INNER JOIN resource_well ON resource_well.id = well_id -INNER JOIN staking_source on staking_event.source_id = staking_source.id -WHERE staking_event.source_id = ? AND staking_source.user_id = ?; - -SELECT name,init_supply -FROM resource_well -INNER JOIN resource ON resource.id = resource_well.resource_id -WHERE source_id = 1; - -SELECT inventory_item.id,store_item_id, COUNT(upgrade_event.id) as upgrades -FROM inventory_item -LEFT JOIN upgrade_event ON inventory_item.id = upgrade_event.inventory_item_id -WHERE inventory_item.user_id = 1 -GROUP BY inventory_item.id; - -SELECT inventory_item.id,store_item_id -FROM inventory_item; - - -SELECT staking_event.id,well_id,staking_event.source_id, - inventory_item_id,staking_event.created_at,expiration_at -FROM staking_event -INNER JOIN staking_source on staking_event.source_id = staking_source.id -WHERE staking_event.source_id = 4 AND staking_source.user_id = 1; - -SELECT staking_event.id, staking_event.well_id, staking_event.source_id, - staking_event.inventory_item_id, staking_event.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 = 4 AND claim_event.staking_event_id IS NULL; diff --git a/mm.py b/mm.py index a580606..4fbff4d 100644 --- a/mm.py +++ b/mm.py @@ -301,8 +301,7 @@ def draw_moons(): def draw_panels(): screen_width, screen_height = glfw.get_video_mode(glfw.get_primary_monitor())[0] - # Main - # TODO: This is probably not the right way to do this + # TODO: We probably don't need to create a "Main" window... im.set_next_window_size(screen_width, screen_height) # Set the next window position to (0, 0) to make the window cover the entire screen diff --git a/queries.sql b/queries.sql new file mode 100644 index 0000000..781d565 --- /dev/null +++ b/queries.sql @@ -0,0 +1,35 @@ +SELECT staking_event.id,well_id,staking_event.source_id, + inventory_item_id,staking_event.created_at,expiration_at +FROM staking_event +INNER JOIN resource_well ON resource_well.id = well_id +INNER JOIN staking_source on staking_event.source_id = staking_source.id +WHERE staking_event.source_id = ? AND staking_source.user_id = ?; + +SELECT name,init_supply +FROM resource_well +INNER JOIN resource ON resource.id = resource_well.resource_id +WHERE source_id = 1; + +SELECT inventory_item.id,store_item_id, COUNT(upgrade_event.id) as upgrades +FROM inventory_item +LEFT JOIN upgrade_event ON inventory_item.id = upgrade_event.inventory_item_id +WHERE inventory_item.user_id = 1 +GROUP BY inventory_item.id; + +SELECT inventory_item.id,store_item_id +FROM inventory_item; + +SELECT staking_event.id,well_id,staking_event.source_id, + inventory_item_id,staking_event.created_at,expiration_at +FROM staking_event +INNER JOIN staking_source on staking_event.source_id = staking_source.id +WHERE staking_event.source_id = 4 AND staking_source.user_id = 1; + +SELECT staking_event.id, staking_event.well_id, staking_event.source_id, + staking_event.inventory_item_id, staking_event.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 = 4 AND claim_event.staking_event_id IS NULL; + +update staking_event set created_at = '2023-02-21 12:58:02';