Skip to content

Commit

Permalink
fix points for user page
Browse files Browse the repository at this point in the history
  • Loading branch information
fey committed Mar 28, 2024
1 parent 324c03d commit dd4f1f2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ public function show(User $user, RatingCalculator $ratingCalculator): View
{
$rating = $ratingCalculator->calculate();
$userInRating = $rating->get($user->id);
if ($userInRating) {
$points = $userInRating->points;
$position = $userInRating->position;
} else {
$points = 0;
$position = 'N/A';
}
$points = $user->points;

$position = $rating->has($user->id)
? $userInRating->position
: 'N/A';

$user->load('chapterMembers', 'exerciseMembers');
$chart = ChartHelper::getChart($user->id);
return view('user.show', compact(
Expand Down

0 comments on commit dd4f1f2

Please sign in to comment.