diff --git a/src/langfingaz/recentModerators.py b/src/langfingaz/recentModerators.py index 5f9c2e9..65b2389 100644 --- a/src/langfingaz/recentModerators.py +++ b/src/langfingaz/recentModerators.py @@ -34,6 +34,7 @@ def getModerators(dataDir: Path = fileUtil.getDataDir()) -> Dict[parseMeetings.U if attendee.role == "MODERATOR"] moderatorCount: Dict[parseMeetings.User, int] = {} + moderator: parseMeetings.User for moderator in moderators: count: int = 1 if moderator in moderatorCount: @@ -46,5 +47,20 @@ def getModerators(dataDir: Path = fileUtil.getDataDir()) -> Dict[parseMeetings.U def printModerators(): - moderators: Dict[parseMeetings.User, int] = getModerators() - [print(moderator.fullName + ":\t" + str(count)) for moderator, count in moderators.items()] + """ + There may be multiple (different) User objects (with different UserIds) that have the + same name. This may come from one user joining different meetings. + + This method reduces Users to their fullNames. + """ + + moderatorUsers: Dict[parseMeetings.User, int] = getModerators() + + moderatorNames: Dict[str, int] = {} + user: parseMeetings.User + for user, count in moderatorUsers.items(): + if user.fullName in moderatorNames: + count += moderatorNames[user.fullName] + moderatorNames[user.fullName] = count + + [print(fullName + ":\t" + str(count)) for fullName, count in moderatorNames.items()]