# 가입일보다 앞서 '이달의 신규 사용자' 배지가 수여됨

**URL:** https://meta.discourse.org/t/new-user-of-the-month-badge-awarded-before-registraton-date/157347
**Category:** Bug
**Created:** [7월 10, 2020, 11:20오전 UTC](https://meta.discourse.org/t/new-user-of-the-month-badge-awarded-before-registraton-date/157347 "2020-07-10T11:20:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jughead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jughead/32/184261_2.png) [@jughead](https://meta.discourse.org/u/jughead)
#### Post date: [7월 10, 2020, 11:20오전 UTC](https://meta.discourse.org/t/new-user-of-the-month-badge-awarded-before-registraton-date/157347/1 "2020-07-10T11:20:32Z")

</div>

모두 안녕하세요!

방금 두 명의 사용자에게 실제 가입일보다 이른 시점에 ‘이번 달의 신규 사용자’ 배지가 부여된 것을 발견했습니다. 이런 일이 가능할까요?

![](https://global.discourse-cdn.com/meta/original/3X/f/7/f7e74a12a96c21a049b21d8d3033d2a7bbfb66db.png)  
 ![](https://global.discourse-cdn.com/meta/original/3X/2/f/2f404de4640174fc4fb2cf955796f5fbcbbaf909.png)

현재 가입일보다 이전에 이 배지를 받은 멤버가 두 명 있습니다.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [7월 11, 2020, 1:05오전 UTC](https://meta.discourse.org/t/new-user-of-the-month-badge-awarded-before-registraton-date/157347/2 "2020-07-11T01:05:10Z")

</div>

> [@jughead](#):
>
> 현재 이 배지를 등록일 전에 부여받은 멤버가 2명 있습니다.

여기서 사용되는 로직에 문제가 있는 것 같습니다:

> <https://github.com/discourse/discourse/blob/main/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb#L13-L25>

이 코드는 이전 달의 시작 시점 이후에 생성된 모든 사용자의 통계를 확인합니다. 따라서 사용자가 6월 중순에 가입한 경우, 5월 초부터 6월 중순까지의 통계를 확인하게 됩니다. 이후 배지의 `created_at` 날짜는 이전 달의 마지막 날(5월 31일)로 설정됩니다. 이로 인해 6월에 생성된 사용자에게 5월 말에 ‘이번 달의 신규 사용자(New User of the Month)’ 배지가 수여될 수 있습니다.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [7월 13, 2020, 7:06오후 UTC](https://meta.discourse.org/t/new-user-of-the-month-badge-awarded-before-registraton-date/157347/4 "2020-07-13T19:06:44Z")

</div>

좋은 재현 감사합니다, @simon!

이것이 문제를 수정합니다:

> <https://github.com/discourse/discourse/commit/a73da42691734d8afddb4a255969c934da6d4ad9>
>
> see: https://meta.discourse.org/t/new-user-of-the-month-badge-awarded-before-reg…istraton-date/157347/2?u=eviltrout

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [7월 13, 2020, 11:54오후 UTC](https://meta.discourse.org/t/new-user-of-the-month-badge-awarded-before-registraton-date/157347/5 "2020-07-13T23:54:35Z")

</div>


