diff --git a/app.py b/app.py index 886ceec..d00bbfc 100644 --- a/app.py +++ b/app.py @@ -207,6 +207,9 @@ def get_breeding_combinations(): 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( "breeds.html", selected_monster={ @@ -214,8 +217,57 @@ def get_breeding_combinations(): "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() diff --git a/static/style/output.css b/static/style/output.css index 393898a..76a30d8 100644 --- a/static/style/output.css +++ b/static/style/output.css @@ -626,31 +626,6 @@ video { border-width: 2px; } -.border-teal-500 { - --tw-border-opacity: 1; - border-color: rgb(20 184 166 / var(--tw-border-opacity)); -} - -.border-purple-600 { - --tw-border-opacity: 1; - border-color: rgb(147 51 234 / var(--tw-border-opacity)); -} - -.border-purple-500 { - --tw-border-opacity: 1; - border-color: rgb(168 85 247 / var(--tw-border-opacity)); -} - -.border-purple-400 { - --tw-border-opacity: 1; - border-color: rgb(192 132 252 / var(--tw-border-opacity)); -} - -.border-orange-400 { - --tw-border-opacity: 1; - border-color: rgb(251 146 60 / var(--tw-border-opacity)); -} - .border-slate-400 { --tw-border-opacity: 1; border-color: rgb(148 163 184 / var(--tw-border-opacity)); @@ -666,11 +641,6 @@ video { background-color: rgb(31 41 55 / var(--tw-bg-opacity)); } -.bg-gray-900 { - --tw-bg-opacity: 1; - background-color: rgb(17 24 39 / var(--tw-bg-opacity)); -} - .bg-neutral-800 { --tw-bg-opacity: 1; background-color: rgb(38 38 38 / var(--tw-bg-opacity)); @@ -728,16 +698,16 @@ video { color: rgb(192 132 252 / var(--tw-text-opacity)); } -.text-teal-500 { - --tw-text-opacity: 1; - color: rgb(20 184 166 / var(--tw-text-opacity)); -} - .text-white { --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)); } +.hover\:text-green-700:hover { + --tw-text-opacity: 1; + color: rgb(21 128 61 / var(--tw-text-opacity)); +} + .hover\:text-purple-200:hover { --tw-text-opacity: 1; color: rgb(233 213 255 / var(--tw-text-opacity)); diff --git a/templates/.layout.html b/templates/.layout.html index e5fb217..be0070e 100644 --- a/templates/.layout.html +++ b/templates/.layout.html @@ -7,10 +7,12 @@ {% block head %}{% endblock %} - + {% block body %} {% endblock %} {% for file in js_files %} - -{% endfor %} + + {% endfor %} diff --git a/templates/breeds.html b/templates/breeds.html index e72428b..1a7e56c 100644 --- a/templates/breeds.html +++ b/templates/breeds.html @@ -27,6 +27,15 @@ + {% endif %} {% if used_in_breeds %} +

Used In

+ {% endif %} {% for file in js_files %}