refactored breed combinations to pairs
This commit is contained in:
parent
0c73c2b88c
commit
4b3c76d1a7
14
app.py
14
app.py
@ -134,14 +134,14 @@ def get_breeding_combinations():
|
||||
if breed_id is None:
|
||||
return jsonify({"error": f"No breed information found for {selected_monster}"})
|
||||
|
||||
base_combinations, mate_combinations = get_breeding_info(breed_id)
|
||||
base_pair, mate_pair = get_breeding_pairs(breed_id)
|
||||
|
||||
return render_template(
|
||||
"breeds.html",
|
||||
selected_monster={
|
||||
"name": selected_monster,
|
||||
"base_combinations": base_combinations,
|
||||
"mate_combinations": mate_combinations,
|
||||
"base_pair": base_pair,
|
||||
"mate_pair": mate_pair,
|
||||
},
|
||||
)
|
||||
|
||||
@ -167,7 +167,7 @@ def get_breed_id(target_monster):
|
||||
return None
|
||||
|
||||
|
||||
def get_breeding_info(breed_id):
|
||||
def get_breeding_pairs(breed_id):
|
||||
cursor = g.db.cursor()
|
||||
|
||||
# Fetch base and mate breeding combinations based on the breed ID
|
||||
@ -182,18 +182,18 @@ def get_breeding_info(breed_id):
|
||||
|
||||
breeding_info = cursor.fetchall()
|
||||
|
||||
base_combinations = [
|
||||
base_pair = [
|
||||
value
|
||||
for (requirement_type, value) in breeding_info
|
||||
if requirement_type == "base"
|
||||
]
|
||||
mate_combinations = [
|
||||
mate_pair = [
|
||||
value
|
||||
for (requirement_type, value) in breeding_info
|
||||
if requirement_type == "mate"
|
||||
]
|
||||
|
||||
return base_combinations, mate_combinations
|
||||
return base_pair, mate_pair
|
||||
|
||||
|
||||
@app.route("/footer")
|
||||
|
@ -5,22 +5,22 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Breeding Combinations</title>
|
||||
<title>Breeding Pairs</title>
|
||||
<link rel="stylesheet" href="../static/style/output.css" />
|
||||
</head>
|
||||
<body class="font-mono text-white bg-slate-700">
|
||||
<div id="breedingCombinations">
|
||||
<div id="breedingPairs">
|
||||
{% if selected_monster %}
|
||||
<h2 class="text-xl font-bold text-center">Breeding Pairs</h2>
|
||||
<div class="grid grid-cols-2 gap-1">
|
||||
<div class="col-span-1">
|
||||
<h3 class="text-lg font-bold">Base</h3>
|
||||
<ul>
|
||||
{% for combination in selected_monster.base_combinations %}
|
||||
{% for pair in selected_monster.base_pair %}
|
||||
<li id="parent" class="text-center cursor-pointer hover:text-red-700 w-fit">
|
||||
<!-- Add a class to make the monster name clickable -->
|
||||
<span class="monster-name" data-name="{{ combination }}"
|
||||
>{{ combination }}</span
|
||||
<span class="monster-name" data-name="{{ pair }}"
|
||||
>{{ pair }}</span
|
||||
>
|
||||
</li>
|
||||
{% endfor %}
|
||||
@ -29,11 +29,11 @@
|
||||
<div class="col-span-1">
|
||||
<h3 class="text-lg font-bold">Mates</h3>
|
||||
<ul>
|
||||
{% for combination in selected_monster.mate_combinations %}
|
||||
{% for pair in selected_monster.mate_pair %}
|
||||
<li id="parent" class="cursor-pointer hover:text-red-700 w-fit">
|
||||
<!-- Add a class to make the monster name clickable -->
|
||||
<span class="monster-name" data-name="{{ combination }}"
|
||||
>{{ combination }}</span
|
||||
<span class="monster-name" data-name="{{ pair }}"
|
||||
>{{ pair }}</span
|
||||
>
|
||||
</li>
|
||||
{% endfor %}
|
||||
@ -42,6 +42,5 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user