From b3e21c4f4c08af9f80dfd35eae0f0b5ed3aeeef0 Mon Sep 17 00:00:00 2001 From: Philip Clifton Date: Tue, 7 Mar 2017 15:07:30 +0000 Subject: [PATCH] Fix bug with saving comments & mins late --- src/Writeback/SessionAttendanceRecord.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Writeback/SessionAttendanceRecord.php b/src/Writeback/SessionAttendanceRecord.php index 9074aa2..47616e7 100644 --- a/src/Writeback/SessionAttendanceRecord.php +++ b/src/Writeback/SessionAttendanceRecord.php @@ -175,11 +175,15 @@ public function toArray() 'attendance_code_id' => $this->getAttendanceCodeId() ]; - if ($comment = $this->getComment() && ! empty($comment)) { + $comment = $this->getComment(); + + if ( ! empty($comment)) { $required['comment'] = $comment; } - if($minutesLate = $this->getMinutesLate() && !empty($minutesLate)) { + $minutesLate = $this->getMinutesLate(); + + if ( ! empty($minutesLate)) { $required['minutes_late'] = $minutesLate; } @@ -214,7 +218,7 @@ public function setComment($comment) */ public function setMinutesLate($number) { - if(!is_numeric($number)) { + if ( ! is_numeric($number)) { throw new InvalidInputException('Only pass a numeric value to minutes late'); }