openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

Questions show "0 Replies" even when there are replies #99

Closed bree-z closed 7 years ago

bree-z commented 7 years ago

This happens for new and old questions, and when the label is marked "In-Progress" and marked “Answered.”

When I view an individual question with at least one reply and then click the back button to return to the question list page, the correct number of replies now appears. But if I reload the page, it reverts to "0 Replies."

I tested on Firefox, Chrome, and Safari.

Question List: 0 Replies

replies_zero

Question Detail View

replies_questiondetail

Back to Question List

replies_backfromquestiondetail

boonebgorges commented 7 years ago

Thanks so much for the detailed report, @bree-z. This problem cropped up when Reply counts were added to the Index view in #96. Previously, the counts were deterimed by counting the actual responses as reported by the API. But while this data is present in Single view (where responses are actually shown), it's not available on Index view, which is why it was coming up as a 0. I changed this so that the count happens on the server instead, so that it's always available.

The one trick to this is that adding a response must increase the cached count from the server. I've now got some logic in place to do this. Please give it a test - the Replies count should update when new responses are created.

bree-z commented 7 years ago

Thanks, Boone! This looks good.