diff --git a/app.py b/app.py index 6a73245..bc7e3c5 100644 --- a/app.py +++ b/app.py @@ -9,7 +9,7 @@ from src.api.get_breeding_pairs import * from src.api.get_breeding_usage import * from src.views.serve_content import * -from src.views.breed_info import * + from src.views.skills import * app = Flask(__name__) @@ -29,7 +29,6 @@ app.register_blueprint(get_breeding_usage_bp) app.register_blueprint(serve_content) # Register Other Views Blurprints (HTML Render Templates) -app.register_blueprint(breed_info_bp) app.register_blueprint(skills_bp) @app.route("/") diff --git a/src/views/breed_info.py b/src/views/breed_info.py deleted file mode 100644 index a1e7775..0000000 --- a/src/views/breed_info.py +++ /dev/null @@ -1,129 +0,0 @@ -from flask import Blueprint, render_template, g, request -import jsonify - -breed_info_bp = Blueprint('view_breed_info', __name__) - -@breed_info_bp.route("/breed") -def get_breeding_combinations(): - selected_monster = request.args.get("monster") - if not selected_monster: - return jsonify({"error": "Invalid input"}) - - # Fetch breed ID based on the selected monster as a target - breed_id = get_breed_id(selected_monster) - - if breed_id is None: - return jsonify({"error": f"No breed information found for {selected_monster}"}) - - base_pair, mate_pair = get_breeding_pairs(breed_id) - - # Fetch breeds in which the selected monster is used - used_in_breeds = get_used_in_breeds(selected_monster) - - return render_template( - "breed.html", - selected_monster={ - "name": selected_monster, - "base_pair": base_pair, - "mate_pair": mate_pair, - }, - used_in_breeds=used_in_breeds, - ) - -def get_used_in_breeds(target_monster): - cursor = g.db.cursor() - - # Fetch breed IDs where the selected monster is used as a base - cursor.execute( - """ - SELECT breed_id - FROM breed_requirements - WHERE requirement_type = 'base' - AND requirement_value = ? - """, - (target_monster,), - ) - - base_breed_ids = [row[0] for row in cursor.fetchall()] - - # Fetch breed IDs where the selected monster is used as a mate - cursor.execute( - """ - SELECT breed_id - FROM breed_requirements - WHERE requirement_type = 'mate' - AND requirement_value = ? - """, - (target_monster,), - ) - - mate_breed_ids = [row[0] for row in cursor.fetchall()] - - # Combine the results from both queries - used_in_breed_ids = base_breed_ids + mate_breed_ids - - # Fetch the target monsters for the obtained breed IDs - used_in_breeds = [] - for breed_id in used_in_breed_ids: - cursor.execute( - """ - SELECT target - FROM breeds - WHERE id = ? - """, - (breed_id,), - ) - target_monster = cursor.fetchone() - if target_monster: - used_in_breeds.append(target_monster[0]) - - return used_in_breeds - -def get_breed_id(target_monster): - cursor = g.db.cursor() - - # Fetch breed ID based on the selected monster as a target - cursor.execute( - """ - SELECT breeds.id - FROM breeds - WHERE breeds.target = ? - """, - (target_monster,), - ) - - breed_id = cursor.fetchone() - - if breed_id: - return breed_id[0] - else: - return None - - -def get_breeding_pairs(breed_id): - cursor = g.db.cursor() - - # Fetch base and mate breeding combinations based on the breed ID - cursor.execute( - """ - SELECT requirement_type, requirement_value - FROM breed_requirements - WHERE breed_id = ? - """, - (breed_id,), - ) - - breeding_info = cursor.fetchall() - - base_pair = [ - value - for (requirement_type, value) in breeding_info - if requirement_type == "base" - ] - mate_pair = [ - value - for (requirement_type, value) in breeding_info - if requirement_type == "mate" - ] - - return base_pair, mate_pair \ No newline at end of file diff --git a/static/js/indexListener.js b/static/js/indexListener.js index d9c6ba6..19de395 100644 --- a/static/js/indexListener.js +++ b/static/js/indexListener.js @@ -19,7 +19,6 @@ document.addEventListener("DOMContentLoaded", function () { }); monsterDropdown.addEventListener("change", function () { - updateIframes(); updateMonsterStats(); updateMonsterName(); updateMonsterFamily(); diff --git a/static/js/updateIFrames.js b/static/js/updateIFrames.js deleted file mode 100644 index 1e5b810..0000000 --- a/static/js/updateIFrames.js +++ /dev/null @@ -1,10 +0,0 @@ -function updateIframes() { - const selectedMonster = monsterDropdown.value; - - // Update breedingIframe src based on the selected monster - const breedingIframeSrc = selectedMonster - ? `/breed?monster=${selectedMonster}` - : "about:blank"; - - breedingIframe.src = breedingIframeSrc; -} \ No newline at end of file diff --git a/templates/app.html b/templates/app.html index 1386c9e..4fae497 100644 --- a/templates/app.html +++ b/templates/app.html @@ -57,14 +57,7 @@ width="200" > - +