lundi 25 février 2019

Get user rank position based on total score and time

I want to get user rank position based on the total score and average time. but the query I am using its provide wrong postion number

$myId = TotalScore::where('user_id', $user_id)->first();
$position = TotalScore::where('ts', '>=', $myId->ts)->where('avg_times_taken', '>=', $myId->avg_times_taken)->count();

this is the code I am using.

enter image description here

this is the table structure I am using.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2UdyAb3
via IFTTT

Aucun commentaire:

Enregistrer un commentaire