From bc81b477b1e24b62e9330e39528ea9026739d15b Mon Sep 17 00:00:00 2001 From: Girish Raghav Date: Mon, 19 Feb 2024 21:05:17 +0530 Subject: [PATCH] check --- apps/flask/.gitignore | 1 + apps/flask/main.py | 14 +++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/flask/.gitignore b/apps/flask/.gitignore index 7bbcc31..5950890 100644 --- a/apps/flask/.gitignore +++ b/apps/flask/.gitignore @@ -155,6 +155,7 @@ cython_debug/ firebase.json trial.py +blah.py # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can diff --git a/apps/flask/main.py b/apps/flask/main.py index 68ac38e..feb1b44 100644 --- a/apps/flask/main.py +++ b/apps/flask/main.py @@ -106,18 +106,14 @@ def add_details(): def get_data_from_firestore(): doc_ref = db.collection('needs_and_gives') docs = doc_ref.stream() - need_list = [] - give_list = [] + data_list = [] for doc in docs: - data = doc.to_dict() - if 'need' in data: - need_list.extend(data['need']) - if 'give' in data: - give_list.extend(data['give']) + data_list.append(doc.to_dict()) - result = {"need": need_list, "give": give_list} - return jsonify(result), 200 + # Accessing dictionaries by index + result = {"need":data_list[1]["need"],"give":data_list[0]["give"]} + return jsonify(result)