Correct Reply Count with API 2
Scenario:
One Topic with two replies.
First reply was, obviously, a reply to the OP.
Second reply was a reply to the first reply.
Using the original API(/threads/id/<id>/replies/count) I get: 2.
Using API 2 (SELECT count(*) FROM messages WHERE parent.id = '<id>') I get: 1.
Now, I did this test because I was getting this mismatch on an existing topic and I figured that the issue is the "parent" in the "parent.id". Because the second reply was a reply to the reply and not, technically a reply to the OP, it isn't being nested and not considered a child of the topic (I guess)?
Is this a bug, or is there another, better, way to count ALL replies/messages in a topic?
PerBonomi VarunGrazitti Using APIv2 you could query for the message count of the whole conversation:
SELECT conversation.messages_count FROM messages WHERE id = '<id>' AND depth = 0
The conversation.messages_count includes the original post. To get the count of all replies only you could simply do something like
<#assign true_reply_count = (messages_count?number - 1) />
Kind regards,
Christian