diff --git a/.gitignore b/.gitignore index 9797cdc..3d3b428 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ target/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More informion here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock +#Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk diff --git a/api/main.py b/api/main.py index b8bc727..f34dd54 100644 --- a/api/main.py +++ b/api/main.py @@ -9,7 +9,7 @@ glob_return_dict = {} -@app.get("/start_query") +@app.post("/start_query") def start_query(query: str, params: list): h = sha256(query.encode()) h.update(bytes(int(time.time()))) @@ -20,9 +20,9 @@ def start_query(query: str, params: list): return qid -@app.get("/query_ready") +@app.post("/query_ready") def query_status(qid: str): return "true" if glob_return_dict[qid] is not None else "false" -@app.get("/get_result") +@app.post("/get_result") def query_result(qid: str): return list(glob_return_dict[qid]) diff --git a/create_database.py b/create_database.py index 35b0fa9..dbad76c 100644 --- a/create_database.py +++ b/create_database.py @@ -19,6 +19,44 @@ def create_schema(): # Clean up old tables cursor.execute("DROP TABLE IF EXISTS planets;") cursor.execute("DROP TABLE IF EXISTS stars;") + cursor.execute("DROP TABLE IF EXISTS themes;") + + cursor.execute(""" + CREATE TABLE themes ( + id SMALLINT PRIMARY KEY, + name TEXT, + temperature REAL, + ocean_type SMALLINT + ); + """) + cursor.execute(""" + INSERT INTO themes (id, name, temperature, ocean_type) VALUES + (1, 'Ocean 1', 0.0, 1000), + (2, 'Gas 1', 2.0, 0), + (3, 'Gas 2', 1.0, 0), + (4, 'Gas 3', -1.0, 0), + (5, 'Gas 4', -2.0, 0), + (6, 'Desert 1', 2.0, 0), + (7, 'Desert 2', -1.0, 0), + (8, 'Ocean 2', 0.0, 1000), + (9, 'Lava 1', 5.0, -1), + (10, 'Ice 1', -5.0, 1000), + (11, 'Desert 3', -2.0, 0), + (12, 'Desert 4', 1.0, 0), + (13, 'Volcanic 1', 4.0, 1116), + (14, 'Ocean 3', 0.0, 1000), + (15, 'Ocean 4', 0.0, 1000), + (16, 'Ocean 5', 0.0, 1000), + (17, 'Desert 5', 1.0, 0), + (18, 'Ocean 6', 0.0, 1000), + (19, 'Desert 6', 1.0, 0), + (20, 'Desert 7', -2.0, -2), + (21, 'Gas 5', 1.0, 0), + (22, 'Desert 8', 0.0, 1000), + (23, 'Desert 9', 0.08, 0), + (24, 'Desert 10', -4.0, 0), + (25, 'Desert 11', 0.0, 1000); + """) ore_cols = ",\n".join([f"ore_{ore} INT" for ore in veins]) @@ -47,13 +85,11 @@ def create_schema(): star_id INT, {vein_cols}, sun_distance REAL, - temperature REAL, gas_h REAL, gas_d REAL, gas_i REAL, index SMALLINT, orbiting SMALLINT, - water_item SMALLINT, satellites SMALLINT, theme_id SMALLINT, gas_giant BOOL, @@ -88,7 +124,6 @@ def index(table, val): index("stars", "type") index("stars", "spectr") index("planets", "gas_giant") - index("planets", "temperature") conn.commit() cursor.close() diff --git a/frontend/css/style.css b/frontend/css/style.css index 2365c77..4f74ae6 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css @@ -110,3 +110,8 @@ pre { white-space: pre-wrap; word-break: break-all; } +.results-container { + display: flex; + align-items: center; + gap: 10px; +} \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index f681834..617f20d 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -12,6 +12,7 @@