Sto preparando un report sullo “stato della community” e ho pensato che sarebbe divertente elencare i badge “Nuovo Utente del Mese”. Ecco la mia query:
SELECT u.id,
b.name,
u.created_at,
ub.granted_at,
to_char(date_trunc('month', ub.granted_at), 'YYYY Mon')
from badges b
join user_badges ub on b.id = ub.badge_id
join users u on u.id = ub.user_id
where b.name like '%Month%'
order by ub.granted_at desc
I risultati sono strani:
| id | name | created_at | granted_at | to_char |
|---|---|---|---|---|
| 1613225 | New User of the Month | 2022-09-10T14:27:10.130Z | 2022-09-30T23:59:59.999Z | 2022 Sep |
| 1613874 | New User of the Month | 2022-09-18T21:57:19.944Z | 2022-09-30T23:59:59.999Z | 2022 Sep |
| 1611913 | New User of the Month | 2022-08-23T11:30:12.639Z | 2022-08-31T23:59:59.999Z | 2022 Aug |
| 1610355 | New User of the Month | 2022-07-30T20:12:00.342Z | 2022-07-31T23:59:59.999Z | 2022 Jul |
| 1609245 | New User of the Month | 2022-07-12T16:11:48.272Z | 2022-07-31T23:59:59.999Z | 2022 Jul |
| 1607137 | New User of the Month | 2022-06-09T23:37:46.687Z | 2022-06-30T23:59:59.999Z | 2022 Jun |
| 1607399 | New User of the Month | 2022-06-14T14:16:14.247Z | 2022-06-30T23:59:59.999Z | 2022 Jun |
Più spesso che no, vengono assegnati 2 badge “Nuovo Utente del Mese”. Nota che vengono assegnati contemporaneamente. (È anche un po’ strano che un utente possa ricevere il badge dopo un giorno (vedi il badge di luglio), ma è certamente possibile che qualcuno inizi in modo iperattivo.)
Non mi dispiace riconoscere persone extra per i loro buoni contributi, ma vorrei spiegare cosa sta succedendo quando scrivo questo. È anche possibile che ci sia qualcosa di incasinato nella nostra configurazione.