From 5dc49f71088aeeaa8eaa1be32037beff9eaa4d6a Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Tue, 26 May 2026 11:53:16 +0530 Subject: [PATCH] FIX_DUPLICATE_MAIL_LIST --- app/Models/UserModel.php | 18 +++++++++++++++--- app/Views/view_rfq.php | 31 +++++++++++++++++-------------- 2 files changed, 32 insertions(+), 17 deletions(-) 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 @@ + +