dschandra commited on
Commit
2a585d4
·
verified ·
1 Parent(s): a5f7b8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -95,7 +95,8 @@ def parse_po_items_with_filters(text):
95
  current_item["Unit"] = qty_match.group(2)
96
  else:
97
  print(f"No Qty match found in line: {line}") # Debugging
98
- current_item["Qty"] = "Not Found" # Default if no match
 
99
 
100
  # Match Unit Price and Total Price
101
  price_match = re.search(price_pattern, line)
@@ -105,8 +106,9 @@ def parse_po_items_with_filters(text):
105
  current_item["Total Price"] = price_match.group("TotalPrice")
106
  else:
107
  print(f"No price match found in line: {line}") # Debugging
108
- current_item["Unit Price"] = "Not Found"
109
- current_item["Total Price"] = "Not Found"
 
110
 
111
  # Finalize the last item
112
  if current_item is not None:
 
95
  current_item["Unit"] = qty_match.group(2)
96
  else:
97
  print(f"No Qty match found in line: {line}") # Debugging
98
+ if current_item is not None:
99
+ current_item["Qty"] = "Not Found" # Default if no match
100
 
101
  # Match Unit Price and Total Price
102
  price_match = re.search(price_pattern, line)
 
106
  current_item["Total Price"] = price_match.group("TotalPrice")
107
  else:
108
  print(f"No price match found in line: {line}") # Debugging
109
+ if current_item is not None:
110
+ current_item["Unit Price"] = "Not Found"
111
+ current_item["Total Price"] = "Not Found"
112
 
113
  # Finalize the last item
114
  if current_item is not None: