# 게시물+댓글을 선택하면 게시물의 수가 잘못 계산됩니다

**URL:** https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242
**Category:** Bug
**Created:** [6월 6, 2022, 7:18오후 UTC](https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242 "2022-06-06T19:18:34Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mbauman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbauman/32/139835_2.png) [@mbauman](https://meta.discourse.org/u/mbauman)
#### Post date: [6월 6, 2022, 7:18오후 UTC](https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242/1 "2022-06-06T19:18:34Z")

</div>

53개의 답글이 있는 주제(topic)가 있습니다. 이 주제를 순회하면서 각 게시물을 개별적으로 **선택** 하면 53개의 게시물이 선택됩니다. 👍

하지만, 주제를 순회하면서 **답글 포함 선택** 버튼(사용 가능한 경우, 그렇지 않으면 그냥 **선택** )을 사용하면 게시물의 수가 60개로 나타납니다:

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/d/9/ad9afc80ebf36c3f5b81dd68f1cd821547f94a7e.png)

사실, 답글이 있는 게시물을 **선택 해제** 하면 카운트가 1씩 줄어듭니다. 하지만 다시 **답글 포함 선택** 을 하면 카운트가 **2** 씩 다시 올라갑니다!

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/d/d/cdd151e1942bf75dc0d6e8bb41c6f2ad0bd3b1b1.png)

이것이 왜 중요한가요? 첫째, 시스템이 주제에 있는 게시물 수(또는 그 이상)만큼 게시물이 선택되었다고 판단하면, 선택된 게시물로부터 새 주제를 생성할 수 없게 됩니다! 제가 처음 이 버그를 발견한 이유도 바로 이것입니다:

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/c/4/fc40a16068d2b663874abca2fa1f4ec71fefa1cf.png)

---

<div class="post-metadata">

### Author: ![mbauman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbauman/32/139835_2.png) [@mbauman](https://meta.discourse.org/u/mbauman)
#### Post date: [6월 6, 2022, 7:52오후 UTC](https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242/2 "2022-06-06T19:52:54Z")

</div>

이건 정말 웃기네요:

---

<div class="post-metadata">

### Author: ![not-ethan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/not-ethan/32/282617_2.png) [@not-ethan](https://meta.discourse.org/u/not-ethan)
#### Post date: [6월 6, 2022, 9:32오후 UTC](https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242/3 "2022-06-06T21:32:40Z")

</div>

꽤 재미있네요. 이 문제는 해당 카운트에 잠금, 비공개, 기타 관리자 메시지 등이 포함되고 있기 때문에 발생하는 것일 수 있습니다.

---

<div class="post-metadata">

### Author: ![mbauman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mbauman/32/139835_2.png) [@mbauman](https://meta.discourse.org/u/mbauman)
#### Post date: [6월 6, 2022, 9:43오후 UTC](https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242/4 "2022-06-06T21:43:31Z")

</div>

저도 처음에는 그렇게 생각했지만, 해당 테스트 토픽에는 그런 관리자 메시지가 없습니다.

---

<div class="post-metadata">

### Author: ![ghassan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ghassan/32/263566_2.png) [@ghassan](https://meta.discourse.org/u/ghassan)
#### Post date: [6월 14, 2022, 9:12오전 UTC](https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242/5 "2022-06-14T09:12:34Z")

</div>

방금 이 문제를 조사하고 있었어요. ~~하지만 재현할 수 없었어요~~. (현재 discourse의 master 브랜치를 실행 중이며 마지막 커밋은 e7e23e8d9ce73ac61b970d5192f9f4af90b3a87c입니다)

토픽을 생성하고 일반적인 게시글과 답글을 작성했습니다. 그리고 일관된 결과를 얻었습니다. '선택+답글’을 선택하면 게시글과 해당 답글들이 자동으로 선택됩니다.

참고: 토픽, 게시글, 답글은 모두 동일한 사용자가 생성한 것입니다.

수정: 선택을 해제한 후 다시 선택하면 재현할 수 있었습니다. 문제의 원인은 '선택+답글’을 해제한 후 다시 해제하는 과정이라고 생각합니다.

- 답글이 해제되지 않습니다.
- '선택+답글’을 다시 선택하면 답글이 중복 선택됩니다(이미 선택된 상태임에도 불구하고)

---

<div class="post-metadata">

### Author: ![ghassan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ghassan/32/263566_2.png) [@ghassan](https://meta.discourse.org/u/ghassan)
#### Post date: [6월 14, 2022, 9:57오전 UTC](https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242/6 "2022-06-14T09:57:19Z")

</div>

방금 수정 사항을 제안하기 위해 PR을 열었습니다: [FIX: double selecting replies - Pull Request #17086 - discourse/discourse - GitHub](https://github.com/discourse/discourse/pull/17086)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [7월 9, 2022, 2:40오후 UTC](https://meta.discourse.org/t/selecting-posts-replies-miscounts-the-number-of-posts/229242/7 "2022-07-09T14:40:27Z")

</div>

이 주제는 7시간 후 자동으로 닫혔습니다. 더 이상 새 답변을 게시할 수 없습니다.
