Spaces:
Sleeping
Sleeping
williamagyapong
commited on
Update utility.py
Browse files- utility.py +2 -2
utility.py
CHANGED
@@ -266,7 +266,7 @@ def update_transaction(user_phone, transaction_id, update_data):
|
|
266 |
|
267 |
def fetch_transaction(user_phone, transaction_id=None):
|
268 |
if transaction_id:
|
269 |
-
doc_ref = db.collection("users").document(user_phone).collection("
|
270 |
transaction = doc_ref.get()
|
271 |
if transaction.exists:
|
272 |
return transaction.to_dict()
|
@@ -274,7 +274,7 @@ def fetch_transaction(user_phone, transaction_id=None):
|
|
274 |
# print("Transaction not found.")
|
275 |
return None
|
276 |
else:
|
277 |
-
collection_ref = db.collection("users").document(user_phone).collection("
|
278 |
transactions = [doc.to_dict() for doc in collection_ref.stream()]
|
279 |
return transactions
|
280 |
|
|
|
266 |
|
267 |
def fetch_transaction(user_phone, transaction_id=None):
|
268 |
if transaction_id:
|
269 |
+
doc_ref = db.collection("users").document(user_phone).collection("inventory").document(transaction_id)
|
270 |
transaction = doc_ref.get()
|
271 |
if transaction.exists:
|
272 |
return transaction.to_dict()
|
|
|
274 |
# print("Transaction not found.")
|
275 |
return None
|
276 |
else:
|
277 |
+
collection_ref = db.collection("users").document(user_phone).collection("inventory")
|
278 |
transactions = [doc.to_dict() for doc in collection_ref.stream()]
|
279 |
return transactions
|
280 |
|