Skip to content

Commit e71b98f

Browse files
author
reallyli
committed
hot fix export test result
1 parent 1e9a2b7 commit e71b98f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/Commands/ExportCommand.php

+6-10
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ public function __construct()
4646
public function handle()
4747
{
4848
$experiments = Experiment::active()->get();
49-
$goals = array_unique(Goal::active()->orderBy('name')->lists('name'));
49+
$goals = array_unique(Goal::active()->orderBy('name')->pluck('name')->toArray());
5050

5151
$columns = array_merge(['Experiment', 'Visitors', 'Engagement'], array_map('ucfirst', $goals));
5252

5353
$writer = new Writer(new SplTempFileObject);
5454
$writer->insertOne($columns);
5555

56-
foreach ($experiments as $experiment)
57-
{
56+
foreach ($experiments as $experiment) {
5857
$engagement = $experiment->visitors ? ($experiment->engagement / $experiment->visitors * 100) : 0;
5958

6059
$row = [
@@ -63,10 +62,9 @@ public function handle()
6362
number_format($engagement, 2) . " % (" . $experiment->engagement .")",
6463
];
6564

66-
$results = $experiment->goals()->lists('count', 'name');
65+
$results = $experiment->goals()->pluck('count', 'name');
6766

68-
foreach ($goals as $column)
69-
{
67+
foreach ($goals as $column) {
7068
$count = array_get($results, $column, 0);
7169
$percentage = $experiment->visitors ? ($count / $experiment->visitors * 100) : 0;
7270

@@ -78,13 +76,11 @@ public function handle()
7876

7977
$output = (string) $writer;
8078

81-
if ($file = $this->argument('file'))
82-
{
79+
if ($file = $this->argument('file')) {
8380
$this->info("Creating $file");
8481

8582
File::put($file, $output);
86-
}
87-
else
83+
} else
8884
{
8985
$this->line($output);
9086
}

0 commit comments

Comments
 (0)