Skip to content

Commit

Permalink
check
Browse files Browse the repository at this point in the history
  • Loading branch information
wreckage0907 committed Feb 19, 2024
1 parent 1e13d55 commit bc81b47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions apps/flask/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions apps/flask/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)



Expand Down

0 comments on commit bc81b47

Please sign in to comment.