Skip to content

Commit

Permalink
Merge pull request #1063 from biigle/patch-1
Browse files Browse the repository at this point in the history
Fix issue with report CSV line count
  • Loading branch information
mzur authored Jan 30, 2025
2 parents e7bd08d + 82f654b commit f151e5d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/Services/Reports/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getPath()
public function put($content)
{
if (is_string($content)) {
return fwrite($this->handle, $content);
return fwrite($this->handle, $content."\n");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function createNdJSON($items)
$geometry = $this->estimateAnnotationPosition($item);

$feature = new Feature($geometry, $properties);
$file->put(json_encode($feature)."\n");
$file->put(json_encode($feature));
});
$file->close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function createNdJSON($query, $usedLabels, $labels)
}

$feature = new Feature(new Point([$image->lng, $image->lat]), $properties);
$file->put(json_encode($feature)."\n");
$file->put(json_encode($feature));
});
$file->close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function createNdJSON($query, $usedImageLabels, $imageLabels)
}

$feature = new Feature(new Point([$image->lng, $image->lat]), $properties);
$file->put(json_encode($feature)."\n");
$file->put(json_encode($feature));
});
$file->close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testGenerateReport()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->once();
Expand Down Expand Up @@ -175,7 +175,7 @@ public function testGenerateReportCircle()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->once();
Expand Down Expand Up @@ -263,7 +263,7 @@ public function testGenerateReportLineString()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->once();
Expand Down Expand Up @@ -353,7 +353,7 @@ public function testGenerateReportPolygon()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->once();
Expand Down Expand Up @@ -473,15 +473,15 @@ public function testGenerateReportSeparateLabelTrees()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$jsonContent['properties']['_id'] = $al2->id;
$jsonContent['properties']['_label_name'] = $label2->name;
$jsonContent['properties']['_label_id'] = $label2->id;

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->twice();
Expand Down Expand Up @@ -577,15 +577,15 @@ public function testGenerateReportSeparateUsers()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$jsonContent['properties']['_id'] = $al2->id;
$jsonContent['properties']['_label_name'] = $al2->label->name;
$jsonContent['properties']['_label_id'] = $al2->label->id;

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->twice();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testGenerateReport()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->once();
Expand Down Expand Up @@ -180,7 +180,7 @@ public function testGenerateReportSeparateLabelTrees()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$jsonContent = [
'type' => 'Feature',
Expand All @@ -197,7 +197,7 @@ public function testGenerateReportSeparateLabelTrees()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->twice();
Expand Down Expand Up @@ -280,7 +280,7 @@ public function testGenerateReportSeparateUsers()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$jsonContent = [
'type' => 'Feature',
Expand All @@ -298,7 +298,7 @@ public function testGenerateReportSeparateUsers()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->twice();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testGenerateReport()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->once();
Expand Down Expand Up @@ -171,7 +171,7 @@ public function testGenerateReportSeparateLabelTrees()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$jsonContent = [
'type' => 'Feature',
Expand All @@ -188,7 +188,7 @@ public function testGenerateReportSeparateLabelTrees()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->twice();
Expand Down Expand Up @@ -267,7 +267,7 @@ public function testGenerateReportSeparateUsers()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$jsonContent = [
'type' => 'Feature',
Expand All @@ -285,7 +285,7 @@ public function testGenerateReportSeparateUsers()

$mock->shouldReceive('put')
->once()
->with(json_encode($jsonContent)."\n");
->with(json_encode($jsonContent));

$mock->shouldReceive('close')
->twice();
Expand Down

0 comments on commit f151e5d

Please sign in to comment.