-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetmatches.py
More file actions
22 lines (21 loc) · 797 Bytes
/
getmatches.py
File metadata and controls
22 lines (21 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import firebase_admin
from firebase_admin import credentials, db
def get_matches(mentee_email):
if not firebase_admin._apps:
cred = credentials.Certificate("credentials.json")
firebase_admin.initialize_app(cred, {"databaseURL": "https://limble-30e8a-default-rtdb.asia-southeast1.firebasedatabase.app/"})
ref = db.reference('/')
user_ref = ref.child("mentee")
details = user_ref.get()
matches_list = None # Initialize matches_list as None
flag=0
for i in details:
if mentee_email == details[i]["email"]:
if "matches" in details[i]:
flag=1 # Check if "invites" key exists
matches_list = details[i]["matches"]
break
if flag==1:
return matches_list
else:
return []