Skip to content

Commit e372dad

Browse files
author
Mark Williams
committed
LIMS-1818: Remove empty lines entirely
1 parent 2f24f20 commit e372dad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

api/src/Page/Download.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,17 @@ function _dispensing_csv()
350350
$this->_set_disposition_attachment($this->app->response, $plate["CODE"] . "_targets.csv");
351351
list($width, $height, $type, $attr) = getimagesize($plate['IMAGEFULLPATH']);
352352
foreach ($rows as $r) {
353+
if (!isset($r["POSX"]) || !isset($r["POSY"])) {
354+
continue; # skip empty rows
355+
}
353356
$wellNumber = intval(($r["LOCATION"] - 1) / $dropsPerWell); # 0 indexed
354357
$rowNumber = intval($wellNumber / $plate["WELLPERROW"]); # 0 indexed
355358
$row = $rowNames[$rowNumber];
356359
$column = str_pad($wellNumber - ($rowNumber * $plate["WELLPERROW"]) + 1, 2, 0, STR_PAD_LEFT); # pad with a zero if needed
357360
$dropNumber = intval($r["LOCATION"] - ($dropsPerWell * $wellNumber)); # 1 indexed
358361
$drop = $dropNames[$dropNumber-1];
359-
$xval = $r["POSX"] ? round(($r["POSX"] - $width/2) * $r["MICRONSPERPIXELX"]) : ""; # integers
360-
$yval = $r["POSY"] ? round(($height/2 - $r["POSY"]) * $r["MICRONSPERPIXELY"]) : ""; # integers
362+
$xval = round(($r["POSX"] - $width/2) * $r["MICRONSPERPIXELX"]); # integers
363+
$yval = round(($height/2 - $r["POSY"]) * $r["MICRONSPERPIXELY"]); # integers
361364
print $row . $column . $drop . "," . $xval . "," . $yval . "\n";
362365
}
363366
}

0 commit comments

Comments
 (0)