laravel-review-rateable icon indicating copy to clipboard operation
laravel-review-rateable copied to clipboard

Wrong data resualt when using this method getApprovedRatings() with two different models.

Open DevYSM opened this issue 2 years ago • 1 comments

Hello, guys, we are using your package and when using this method getApprovedRatings() with two different models we are getting a wrong result for example like this.

image

Here you must use the polymorph relationship to call the rates. image

Thanks a lot.

DevYSM avatar Mar 24 '22 15:03 DevYSM

I will look into this when I have time. If you have a fix ready you can send a pull request.

codebyray avatar May 25 '22 23:05 codebyray

@DevYSM Have you checked that the reviewrateable_id for the App\Models\Admin and App\Models\User are not both "2".

It is entirely possible that when the Admin that is being reviewed indeed has an ID of 2 and the gym entry also has and ID of 2. As this references the actual ID for the Model that is being reviewed.

Basically from the results:

Admin with an ID of 2 was rated by User with an ID of 1 Gym with an ID of 2 was rated by User with and ID of 1

It is returning the proper output.

codebyray avatar Aug 17 '22 23:08 codebyray