diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index a73d35ef..8f62c9ae 100755 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -148,10 +148,22 @@ class UserModel extends Model ->get() ->getResultArray(); + // The user_teams join produces one row per (user, team) pair, so users + // belonging to multiple teams appear multiple times. Collapse to one + // row per user while keeping a team_id from [6, 7] when available, so + // the existing in_array($user['team_id'], [6, 7]) checks in the views + // continue to work correctly. + $deduped = []; + foreach ($data as $row) { + $userId = $row['id']; + if (!isset($deduped[$userId])) { + $deduped[$userId] = $row; + } elseif (in_array($row['team_id'], [6, 7])) { + $deduped[$userId]['team_id'] = $row['team_id']; + } + } - // dd($data); - - return $data; + return array_values($deduped); } } diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index b3ec317f..5a6bcbc4 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -1,3 +1,5 @@ + +