Description:
The /api/analytics/overview endpoint exposes a totalFollows field that is presented to users alongside their profile views and unique viewer counts in the analytics dashboard. The field is computed as:
app.prisma.followLog.count({
where: {
followerId: userId,
status: 'success',
},
})
This query counts all FollowLog records where followerId === userId — i.e., follows that this user has performed on other people. The correct semantic for a profile analytics dashboard is the number of times other users followed this user — which would require filtering on targetUsername === currentUser.username (or an equivalent join).
The field name totalFollows combined with its placement next to totalViews and uniqueViewers creates a consistent "how many people engaged with me" narrative that this metric actively breaks. A user who has followed many other developers will see a high totalFollows count that is entirely about their own outbound activity, not their inbound audience.
Affected file: apps/backend/src/routes/analytics.ts (lines 41–45)
Steps to reproduce:
- User A follows users B and C via the DevCard follow API.
- No one follows User A.
- User A opens the analytics dashboard —
totalFollows reads 2, incorrectly implying two people followed them.
Description:
The
/api/analytics/overviewendpoint exposes atotalFollowsfield that is presented to users alongside their profile views and unique viewer counts in the analytics dashboard. The field is computed as:This query counts all
FollowLogrecords wherefollowerId === userId— i.e., follows that this user has performed on other people. The correct semantic for a profile analytics dashboard is the number of times other users followed this user — which would require filtering ontargetUsername === currentUser.username(or an equivalent join).The field name
totalFollowscombined with its placement next tototalViewsanduniqueViewerscreates a consistent "how many people engaged with me" narrative that this metric actively breaks. A user who has followed many other developers will see a hightotalFollowscount that is entirely about their own outbound activity, not their inbound audience.Affected file:
apps/backend/src/routes/analytics.ts(lines 41–45)Steps to reproduce:
totalFollowsreads 2, incorrectly implying two people followed them.