|
|
@@ -231,6 +231,8 @@ class ReportingTest extends TestCase
|
|
|
$event = $this->deposit(); $this->bet();
|
|
|
$row = $this->reader->summary($this->today())['summary']; $this->assertNull($row['net_cash_flow']); $this->assertNull($row['company_profit']);
|
|
|
$this->assertSame(1, $row['quality']['unverified_fees']); $this->assertSame('1000.0000000000', $row['deposit_amount']);
|
|
|
+ $this->assertSame('1000.0000000000', $row['known_net_cash_flow']);
|
|
|
+ $this->assertSame('40.0000000000', $row['known_company_profit']);
|
|
|
$this->verify($event); $row = $this->reader->summary($this->today())['summary'];
|
|
|
$this->assertSame('998.0000000000', $row['net_cash_flow']); $this->assertSame('38.0000000000', $row['company_profit']);
|
|
|
$before = DB::table('balance_logs')->get()->toArray(); $this->verify($event, '1000', '3'); $this->sync->publish('balance_logs', 1);
|
|
|
@@ -263,8 +265,28 @@ class ReportingTest extends TestCase
|
|
|
$this->assertSame('2', $this->reader->details($this->today())['data'][0]['group_id']);
|
|
|
$this->assertSame('10', $this->reader->details(['report_type' => 'promotion'])['data'][0]['group_id']);
|
|
|
$this->assertSame('1', $this->reader->details(['report_type' => 'sharing'])['data'][0]['group_id']);
|
|
|
- $category = $this->reader->summary($this->today())['categories'][8]; $this->assertNull($category['deposit_amount']); $this->assertNull($category['company_profit']);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function test_category_column_options_only_hide_fields_not_applicable_to_game_categories(): void
|
|
|
+ {
|
|
|
+ $this->bet();
|
|
|
+ $this->verify($this->deposit());
|
|
|
+ $hidden = $this->admin->options()['category_hidden_fields'];
|
|
|
+ $this->assertEqualsCanonicalizing([
|
|
|
+ 'deposit_amount', 'withdraw_amount', 'member_withdraw_amount', 'agent_withdraw_amount', 'deposit_fee', 'withdraw_fee',
|
|
|
+ 'customer_fee_income', 'configured_fee', 'bonus_amount', 'manual_credit', 'manual_debit',
|
|
|
+ 'net_cash_flow', 'company_profit', 'known_net_cash_flow', 'known_company_profit',
|
|
|
+ ], $hidden);
|
|
|
+ $report = $this->reader->summary($this->today());
|
|
|
+ $category = collect($report['categories'])->firstWhere('group_id', 'self:lottery');
|
|
|
+ $details = $this->reader->details($this->today(['category' => 'self:lottery']))['data'][0];
|
|
|
+ foreach ($hidden as $field) {
|
|
|
+ $this->assertNotNull($report['summary'][$field]);
|
|
|
+ $this->assertNull($category[$field]);
|
|
|
+ $this->assertNull($details[$field]);
|
|
|
+ }
|
|
|
$this->assertSame('100.0000000000', $category['bet_amount']);
|
|
|
+ $this->assertSame('100.0000000000', $details['bet_amount']);
|
|
|
}
|
|
|
|
|
|
public function test_valid_members_use_both_sharing_thresholds_inclusively(): void
|
|
|
@@ -415,8 +437,17 @@ class ReportingTest extends TestCase
|
|
|
$row = $this->reader->summary($this->today())['summary'];
|
|
|
$this->assertSame(2, $row['activity_minutes']); $this->assertSame(1, $row['active_member_count']); $this->assertSame(4, $row['member_count']);
|
|
|
$this->assertSame('0.250000', $row['active_rate']);
|
|
|
- $old = $this->reader->summary(['start_date' => '2026-10-24', 'end_date' => '2026-10-26'])['summary'];
|
|
|
- $this->assertNull($old['activity_minutes']); $this->assertSame(2, $old['known_activity_minutes']);
|
|
|
+ $this->assertSame('0.250000', $row['known_active_rate']);
|
|
|
+ foreach ([[], ['start_date' => '2026-10-24', 'end_date' => '2026-10-26']] as $filters) {
|
|
|
+ $partial = $this->reader->summary($filters)['summary'];
|
|
|
+ $this->assertNull($partial['activity_minutes']);
|
|
|
+ $this->assertNull($partial['active_rate']);
|
|
|
+ $this->assertSame(2, $partial['known_activity_minutes']);
|
|
|
+ $this->assertSame('0.250000', $partial['known_active_rate']);
|
|
|
+ }
|
|
|
+ $beforeCollection = $this->reader->summary(['start_date' => '2026-10-24', 'end_date' => '2026-10-24'])['summary'];
|
|
|
+ $this->assertSame(0, $beforeCollection['active_member_count']);
|
|
|
+ $this->assertNull($beforeCollection['known_active_rate']);
|
|
|
}
|
|
|
|
|
|
public function test_full_sync_and_repeated_sync_do_not_change_source_data_or_double_count(): void
|
|
|
@@ -570,6 +601,7 @@ class ReportingTest extends TestCase
|
|
|
$after = $this->reader->summary($this->today(['report_type' => 'promotion', 'agent_account' => 'agent10']))['summary'];
|
|
|
$this->assertSame(2, $before['activity_minutes']); $this->assertSame(2, $after['activity_minutes']);
|
|
|
$this->assertSame(1, $after['active_member_count']); $this->assertFalse($after['activity_population_complete']); $this->assertNull($after['active_rate']);
|
|
|
+ $this->assertNull($after['known_active_rate']);
|
|
|
$other = $this->reader->summary($this->today(['report_type' => 'promotion', 'agent_account' => 'agent20']))['summary'];
|
|
|
$this->assertSame(0, $other['activity_minutes']); $this->assertSame(0, $other['active_member_count']);
|
|
|
$details = $this->reader->details($this->today(['report_type' => 'promotion']));
|