Add debug logging to loadFriendProfilesAndSteps
This commit is contained in:
+12
-3
@@ -974,6 +974,7 @@ function getPendingFriendUids() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadFriendProfilesAndSteps(uids) {
|
async function loadFriendProfilesAndSteps(uids) {
|
||||||
|
console.log('loadFriendProfilesAndSteps uids:', uids);
|
||||||
for (const uid of uids) {
|
for (const uid of uids) {
|
||||||
if (!friendProfiles[uid]) {
|
if (!friendProfiles[uid]) {
|
||||||
const pSnap = await getDoc(doc(db, 'profiles', uid));
|
const pSnap = await getDoc(doc(db, 'profiles', uid));
|
||||||
@@ -983,10 +984,18 @@ async function loadFriendProfilesAndSteps(uids) {
|
|||||||
const sSnap = await getDoc(doc(db, 'steps', uid));
|
const sSnap = await getDoc(doc(db, 'steps', uid));
|
||||||
friendSteps[uid] = sSnap.exists() ? sSnap.data().stepsByDate || {} : {};
|
friendSteps[uid] = sSnap.exists() ? sSnap.data().stepsByDate || {} : {};
|
||||||
}
|
}
|
||||||
const theirRef = doc(db, 'friends', uid, 'list', currentUser.uid);
|
try {
|
||||||
const theirSnap = await getDoc(theirRef);
|
const theirRef = doc(db, 'friends', uid, 'list', currentUser.uid);
|
||||||
mutualApproved[uid] = theirSnap.exists() && theirSnap.data().approved === true && theirSnap.data().enabled !== false;
|
const theirSnap = await getDoc(theirRef);
|
||||||
|
console.log('their entry exists:', theirSnap.exists(), 'data:', JSON.stringify(theirSnap.data()));
|
||||||
|
mutualApproved[uid] = theirSnap.exists() && theirSnap.data().approved === true && theirSnap.data().enabled !== false;
|
||||||
|
} catch(e) {
|
||||||
|
console.error('mutualApproved check failed for', uid, e);
|
||||||
|
mutualApproved[uid] = false;
|
||||||
|
}
|
||||||
|
console.log('mutualApproved[uid]:', uid, mutualApproved[uid]);
|
||||||
}
|
}
|
||||||
|
console.log('final mutualApproved:', JSON.stringify(mutualApproved));
|
||||||
}
|
}
|
||||||
|
|
||||||
// LEADERBOARD
|
// LEADERBOARD
|
||||||
|
|||||||
Reference in New Issue
Block a user