Closed gannonmg closed 5 years ago
In order to better help with this issue could you open a case using our client support. Include the details you've provided here but also a few sample products that are being returned with 0 stars.
https://knowledge.bazaarvoice.com/wp-content/knowledge/en_US/Contacting_support.html
Fixed in 8.0.4
The Problem
There is occasionally a 0 star rating attached to a product's BVRatingDistributions. This does not cause a crash on iOS (like it does on Android, which we have also submitted an issue report on), but it does overwrite the fireStarCount, which can lead to misrepresented information.
Steps to Reproduce
Find a product that has at least one zero star rating. When you try to get the distribution for this product's ratings, the fiveStarCount property on BVRatingDistribution will actually equal the number of zero star ratings
Expected Behavior
fiveStarCount should correctly equal the number of 5 star reviews that have been submitted for a product.
Environment
All iOS and Xcode environments have this issue, including device and simulator. I am working on the most recent commit, the release of 8.0.3 from December 12, 2018.
Details
I fixed the issue by editing the source code in BVRatingDistribution.m and BVRatingDistribution.h. In .h, I add the NSNumber property zeroStarCount. In .m, I added a specific case in the switch statement for fiveStarCount (case 5) and made the default assign to self.zeroStarCount. Previously, fiveStarCount was in the default statement, so it was being overwritten by the erroneous zeroStarCount that was coming back.
Link to BVSDK Logs
There are no specific crashes or logs for this issue, simply incorrect behavior that I was able to hunt down do to the similar bug that crashed the Android SDK.
Code To Reproduce Issue [ Very Good To Have ]
I don't have any code to reproduce the issue since it is product dependent, but here is code to fix the issue:
Modified switch statement in BVRatingDistribution.m: switch (valueInt) { case 1: self.oneStarCount = count; break; case 2: self.twoStarCount = count; break; case 3: self.threeStarCount = count; break; case 4: self.fourStarCount = count; break; case 5: self.fiveStarCount = count; break; default: self.zeroStarCount = count; break; }
Additional property in BVRatingDistribution.h: @property(nonnull) NSNumber *zeroStarCount;