Commit 7b22fc4
committed
fix(analytics): use followerId to count outbound follows in totalFollows
The totalFollows query in /api/analytics/overview was filtering by argetUsername: username (the authenticated user's own DevCard username), but follow.ts writes followLog rows with argetUsername = the external platform handle being followed and ollowerId = the actor's user ID.
This mismatch caused totalFollows to always be 0 for real users because no followLog row ever has targetUsername equal to a DevCard username — they hold external handles like GitHub usernames.
Fix: query by ollowerId: userId to correctly count outbound follow actions performed by the authenticated user, which is also what the existing code comment ('Follows performed BY this user') intended.
Also removes the now-unused username destructure from request.user.1 parent 52e4df1 commit 7b22fc4
2 files changed
Lines changed: 64 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 1 | + | |
| 2 | + | |
15 | 3 | | |
16 | 4 | | |
17 | 5 | | |
| 6 | + | |
| 7 | + | |
18 | 8 | | |
19 | 9 | | |
20 | 10 | | |
| |||
34 | 24 | | |
35 | 25 | | |
36 | 26 | | |
37 | | - | |
| 27 | + | |
38 | 28 | | |
39 | 29 | | |
40 | 30 | | |
| |||
217 | 207 | | |
218 | 208 | | |
219 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
220 | 266 | | |
221 | 267 | | |
222 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
| 41 | + | |
43 | 42 | | |
44 | 43 | | |
45 | | - | |
| 44 | + | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
0 commit comments