Remove debug print statements.

This commit is contained in:
Yaro Kasear 2025-07-14 09:07:52 -05:00
parent 76b6882d71
commit 0533f09851
10 changed files with 0 additions and 46 deletions

View file

@ -19,7 +19,6 @@ def is_in_memory_sqlite():
if not uri:
return False
url = make_url(uri)
print(url, url.database)
return url.get_backend_name() == "sqlite" and url.database == ":memory:"
def create_app():

View file

@ -63,9 +63,6 @@ class Area(ValidatableMixin, db.Model):
existing_by_id = {area.id: area for area in existing_query.all()}
existing_ids = set(existing_by_id.keys())
print(f"Existing area IDs: {existing_ids}")
print(f"Submitted area IDs: {seen_ids}")
for entry in submitted_clean:
submitted_id_raw = entry.get("id")
submitted_name = entry["name"]
@ -75,7 +72,6 @@ class Area(ValidatableMixin, db.Model):
db.session.add(new_area)
db.session.flush() # Get the real ID
temp_id_map[submitted_id_raw] = new_area.id
print(f" Adding area: {submitted_name}")
else:
try:
submitted_id = int(submitted_id_raw)
@ -85,13 +81,11 @@ class Area(ValidatableMixin, db.Model):
if submitted_id in existing_by_id:
area = existing_by_id[submitted_id]
if area.name != submitted_name:
print(f"✏️ Updating area {area.id}: '{area.name}''{submitted_name}'")
area.name = submitted_name
for existing_id in existing_ids - seen_ids:
area = existing_by_id[existing_id]
db.session.delete(area)
print(f"🗑️ Removing area: {area.name}")
id_map = {
**{str(i): i for i in seen_ids}, # "1" → 1

View file

@ -56,9 +56,6 @@ class Brand(ValidatableMixin, db.Model):
existing_by_id = {b.id: b for b in db.session.query(cls).all()}
existing_ids = set(existing_by_id.keys())
print(f"Existing brand IDs: {existing_ids}")
print(f"Submitted brand IDs: {seen_ids}")
for entry in submitted_clean:
submitted_id = entry.get("id")
name = entry["name"]
@ -68,7 +65,6 @@ class Brand(ValidatableMixin, db.Model):
db.session.add(obj)
db.session.flush()
temp_id_map[submitted_id] = obj.id
print(f" Adding brand: {name}")
else:
try:
parsed_id = int(submitted_id)
@ -78,12 +74,10 @@ class Brand(ValidatableMixin, db.Model):
if parsed_id in existing_by_id:
obj = existing_by_id[parsed_id]
if obj.name != name:
print(f"✏️ Updating brand {obj.id}: '{obj.name}''{name}'")
obj.name = name
for id_to_remove in existing_ids - seen_ids:
db.session.delete(existing_by_id[id_to_remove])
print(f"🗑️ Removing brand ID {id_to_remove}")
id_map = {
**{str(i): i for i in seen_ids}, # "1" → 1

View file

@ -60,9 +60,6 @@ class Item(ValidatableMixin, db.Model):
existing_by_id = {t.id: t for t in db.session.query(cls).all()}
existing_ids = set(existing_by_id.keys())
print(f"Existing item IDs: {existing_ids}")
print(f"Submitted item IDs: {seen_ids}")
for entry in submitted_clean:
submitted_id = entry["id"]
description = entry["description"]
@ -72,18 +69,15 @@ class Item(ValidatableMixin, db.Model):
db.session.add(obj)
db.session.flush()
temp_id_map[submitted_id] = obj.id
print(f" Adding type: {description}")
elif isinstance(submitted_id, int) or submitted_id.isdigit():
submitted_id_int = int(submitted_id)
obj = existing_by_id.get(submitted_id_int)
if obj and obj.description != description:
print(f"✏️ Updating type {obj.id}: '{obj.description}''{description}'")
obj.description = description
for id_to_remove in existing_ids - seen_ids:
obj = existing_by_id[id_to_remove]
db.session.delete(obj)
print(f"🗑️ Removing type ID {id_to_remove}")
id_map = {
**{str(i): i for i in seen_ids},

View file

@ -58,9 +58,6 @@ class RoomFunction(ValidatableMixin, db.Model):
existing_by_id = {f.id: f for f in db.session.query(cls).all()}
existing_ids = set(existing_by_id.keys())
print(f"Existing function IDs: {existing_ids}")
print(f"Submitted function IDs: {seen_ids}")
for entry in submitted_clean:
submitted_id = entry.get("id")
description = entry["description"]
@ -70,18 +67,15 @@ class RoomFunction(ValidatableMixin, db.Model):
db.session.add(obj)
db.session.flush()
temp_id_map[submitted_id] = obj.id
print(f" Adding function: {description}")
elif isinstance(submitted_id, int) or submitted_id.isdigit():
submitted_id_int = int(submitted_id)
obj = existing_by_id.get(submitted_id_int)
if obj and obj.description != description:
print(f"✏️ Updating function {obj.id}: '{obj.description}''{description}'")
obj.description = description
for id_to_remove in existing_ids - seen_ids:
obj = existing_by_id[id_to_remove]
db.session.delete(obj)
print(f"🗑️ Removing function ID {id_to_remove}")
id_map = {
**{str(i): i for i in seen_ids},

View file

@ -56,7 +56,6 @@ class Room(ValidatableMixin, db.Model):
Supports add, update, and delete.
"""
def resolve_fk(key, fk_map, label):
print(f"Resolving {label} ID: {key} using map: {fk_map}")
if key is None:
return None
key = str(key)
@ -97,9 +96,6 @@ class Room(ValidatableMixin, db.Model):
existing_by_id = {room.id: room for room in existing_query.all()}
existing_ids = set(existing_by_id.keys())
print(f"Existing room IDs: {existing_ids}")
print(f"Submitted room IDs: {seen_ids}")
for entry in submitted_clean:
rid = entry.get("id")
name = entry["name"]
@ -110,7 +106,6 @@ class Room(ValidatableMixin, db.Model):
if not rid or str(rid).startswith("room-"):
new_room = cls(name=name, area_id=resolved_section_id, function_id=resolved_function_id)
db.session.add(new_room)
print(f" Adding room: {new_room}")
else:
try:
rid_int = int(rid)
@ -123,21 +118,12 @@ class Room(ValidatableMixin, db.Model):
print(f"⚠️ No matching room in DB for ID: {rid_int}")
continue
updated = False
if room.name != name:
print(f"✏️ Updating room name {room.id}: '{room.name}''{name}'")
room.name = name
updated = True
if room.area_id != resolved_section_id:
print(f"✏️ Updating room area {room.id}: {room.area_id}{resolved_section_id}")
room.area_id = resolved_section_id
updated = True
if room.function_id != resolved_function_id:
print(f"✏️ Updating room function {room.id}: {room.function_id}{resolved_function_id}")
room.function_id = resolved_function_id
updated = True
if not updated:
print(f"✅ No changes to room {room.id}")
for existing_id in existing_ids - seen_ids:
room = existing_by_id.get(existing_id)
@ -156,11 +142,9 @@ class Room(ValidatableMixin, db.Model):
continue
db.session.delete(room)
print(f"🗑️ Removing room: {room}")
@classmethod
def validate_state(cls, submitted_items: list[dict]) -> list[str]:
print("VALIDATING")
errors = []
for index, item in enumerate(submitted_items):

View file

@ -42,7 +42,6 @@ def upload_image():
# Save file
rel_path = save_image(file, model)
print(rel_path)
# Create Image row
image = Image(filename=rel_path, caption=caption)

View file

@ -41,7 +41,6 @@ def index():
'Deployed','Inoperable', 'Partially Inoperable',
'Unverified', 'Working'
]
print(df)
if 'condition' in df.columns:
pivot = df['condition'].value_counts().reindex(expected_conditions, fill_value=0)
else:

View file

@ -33,7 +33,6 @@ def worklog_entry(id):
item_query = db.session.query(Inventory)
items = eager_load_inventory_relationships(item_query).all()
items = sorted(items, key=lambda i: i.identifier)
print(log)
if log:
title = f'Work Log - Entry #{id}'

View file

@ -38,10 +38,8 @@ def add_named_entities(items: list[str], model, attr: str, mapper: dict | None =
for name in items:
clean = name.strip()
if clean:
print(f"Creating new {attr}: {clean}")
new_obj = model(**{attr: clean})
db.session.add(new_obj)
if mapper is not None:
db.session.flush()
mapper[clean] = new_obj.id
print(f"New {attr} '{clean}' added with ID {new_obj.id}")