diff --git a/MinecraftRecipeViewer/app.py b/MinecraftRecipeViewer/app.py index ea88067..205706a 100644 --- a/MinecraftRecipeViewer/app.py +++ b/MinecraftRecipeViewer/app.py @@ -7,7 +7,7 @@ It contains the definition of routes and views for the application. import mysql.connector import json import os -from item import Item, production_names, to_json +from item import Item, production_names, to_json, units from flask import Flask, render_template, request, session app = Flask(__name__) @@ -31,7 +31,11 @@ def make_tree_view(item): output += "" output += "" - output += f"{item.amount} {item.name}" + unit = item.made_in + if unit not in units: + unit = "default" + + output += units[unit].format(item.name, item.amount) if needs_form: output += "
" - output += f"{component.amount} {component.name}" + unit = component.made_in + if component.made_in not in units: + unit = "default" + + output += units[unit].format(component.name, component.amount) if needs_form: output += "" output += "" - if component.made_in != "natural": + if component.made_in in production_names: output += ""
- if production_names.get(component.made_in) != None:
+ if component.made_in in production_names:
output += f"{production_names[component.made_in]}"
else:
output += "???"
output += "
"
output += component.get_formatted()
- if component.made_in != "natural":
+ if component.made_in in production_names:
output += "