Page MenuHomePhorge

D5805.1775208519.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D5805.1775208519.diff

diff --git a/src/app/Console/Commands/Data/Stats/CollectorCommand.php b/src/app/Console/Commands/Data/Stats/CollectorCommand.php
--- a/src/app/Console/Commands/Data/Stats/CollectorCommand.php
+++ b/src/app/Console/Commands/Data/Stats/CollectorCommand.php
@@ -53,6 +53,10 @@
->where('entitleable_type', User::class)
->groupBy('entitleable_id');
+ $discounts = DB::table('wallets')
+ ->select('wallets.id as wallet_id', 'discounts.discount')
+ ->leftJoin('discounts', 'discounts.id', '=', 'wallets.discount_id');
+
// Count all non-degraded and non-deleted users that are payers
$counts = DB::table('users')
->selectRaw('count(*) as total, users.tenant_id')
@@ -62,6 +66,10 @@
->joinSub($transactions, 'transactions', static function ($join) {
$join->on('wallets.id', '=', 'transactions.wallet_id');
})
+ ->leftJoinSub($discounts, 'discounts', static function ($join) {
+ $join->on('discounts.wallet_id', '=', 'wallets.id');
+ })
+ ->whereRaw('(discounts.discount is null or discounts.discount < 100)')
->whereNull('users.deleted_at')
->whereNot('users.status', '&', User::STATUS_DEGRADED)
->whereNot('users.status', '&', User::STATUS_SUSPENDED)

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 9:28 AM (15 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823461
Default Alt Text
D5805.1775208519.diff (1 KB)

Event Timeline