Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117757867
D5805.1775208519.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D5805.1775208519.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D5805: Stats: Exclude 100% discount accounts from the payers count
Attached
Detach File
Event Timeline