notification-bug-fix #112
| @ -406,14 +406,12 @@ async function getTrainerName(trainerId: string): Promise<string> { | ||||
|       .collection("trainer_profiles") | ||||
|       .doc(trainerId) | ||||
|       .get(); | ||||
| 
 | ||||
|     if (!doc.exists) { | ||||
|       const userDoc = await app | ||||
|         .firestore() | ||||
|         .collection("users") | ||||
|         .doc(trainerId) | ||||
|         .get(); | ||||
| 
 | ||||
|       if (userDoc.exists) { | ||||
|         const userData = userDoc.data(); | ||||
|         return userData?.name || userData?.displayName || "Unknown Trainer"; | ||||
| @ -428,7 +426,6 @@ async function getTrainerName(trainerId: string): Promise<string> { | ||||
|       const lastName = fields["last-name"] || ""; | ||||
|       return `${firstName} ${lastName}`.trim() || "Unknown Trainer"; | ||||
|     } | ||||
| 
 | ||||
|     return data?.name || data?.displayName || "Unknown Trainer"; | ||||
|   } catch (error) { | ||||
|     logger.error(`Error getting trainer name for ${trainerId}:`, error); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user