fix double calculation when mechanic created and auto claim work
This commit is contained in:
@@ -414,9 +414,10 @@ class KpiService
|
||||
->whereMonth('date', $month)
|
||||
->sum('qty');
|
||||
|
||||
// Get transactions claimed by the user
|
||||
// Get transactions claimed by the user (excluding those created by the same user to avoid double counting)
|
||||
$claimedTransactions = Transaction::where('claimed_by', $user->id)
|
||||
->whereNotNull('claimed_at')
|
||||
->where('user_id', '!=', $user->id) // Exclude transactions created by the same user
|
||||
->whereYear('claimed_at', $year)
|
||||
->whereMonth('claimed_at', $month)
|
||||
->sum('qty');
|
||||
|
||||
Reference in New Issue
Block a user