-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_unique.py
29 lines (19 loc) · 935 Bytes
/
update_unique.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import firebase_admin
from firebase_admin import firestore
app = firebase_admin.initialize_app()
db = firestore.client()
blacklistRef = db.collection("teams").document("1").collection("blacklist")
# reset leaderboard
blacklist = [user for user in blacklistRef.stream()]
for user in blacklist:
userInfoRef = db.collection("users").document(user.id)
blacklistEntryRef = blacklistRef.document(user.id)
blacklistEntryRef.update({"email": userInfoRef.get().to_dict()["email"]})
print(userInfoRef.get().to_dict()["email"])
# for attempt in attempts:
# if attempt["uid"] not in userUniqueDrills:
# userUniqueDrills[attempt["uid"]] = set()
# userUniqueDrills[attempt["uid"]].add(attempt["did"])
# for user in users:
# userRef = db.collection("teams").document("1").collection("users").document(user["uid"])
# userRef.update({"uniqueDrills": list(userUniqueDrills.get(user["uid"], set()))})