Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
  • Register
Welcome to the Q&A for Question2Answer.

If you have questions about the platform, click here to ask and please use English.

If you just want to try Q2A, please use the demo, which also grants admin access.

Apr 29: Q2A 1.5.2

Bug: User's Answer count includes hidden posts

+2 votes

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=#

asked Aug 25, 2011 in Q2A Core by DisgruntledGoat

2 Answers

–1 vote

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?

answered Aug 25, 2011 by NoahY
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

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.

answered Aug 27, 2011 by gidgreen
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.