Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
580 views
in Q2A Core by

On the user pages it says something like "Answers: 10 (7 chosen as best)". However this count is including hidden posts! Specifically, answers on hidden questions where the answer itself is not hidden.

I found this while developing my user activity plugin. If you're interested, the method I was using was joining qa_posts to itself on the answer's parentid and question's postid. Essentially: SELECT * FROM ^posts a, ^posts q WHERE a.parentid=q.postid AND a.type="A" AND q.type="Q" AND a.userid=#

2 Answers

–1 vote
by

Yep, it's just taking the information from ^userpoints, via qa_db_user_points_selectspec():

            'source' => '^userpoints WHERE userid='.($isuserid ? '$' : '(SELECT userid FROM ^users WHERE handle=$ LIMIT 1)'),

I'm not sure this is necessarily a bug... just because an answer has been hidden, doesn't mean you didn't give it :)

A good question might be, if the answer is deleted, does the count change?

by
I would assume so because then it's not in the database to be able to be counted, visible or not. I still see it as a bug because it's quite confusing so say "you're given 10 answers" but the user can only see 8. Another reason we need better controls for closing/locking questions :)
0 votes
by

This is by intention, though I could see it either way. My thinking was that if you answer a question which is subsequently hidden, you shouldn't necessarily be penalized for that. FYI, the relevant calculation is in the 'aposts' element of the big array in function qa_db_points_calculations() in qa-db-points.php.

by
Yeah I see the idea with points and so on. But it does feel a little confusing to say there are N number of answers if you can only see 90% of those answers. Not a biggie though.
...