From 626174953bebc47c0d19f9de38d2cbff8c61962a Mon Sep 17 00:00:00 2001 From: Meritoo Date: Sun, 22 Oct 2017 18:18:16 +0200 Subject: [PATCH] Participant has completed survey - fix getting proper information --- src/Result/Item/Participant.php | 7 ++++++- tests/Result/Item/ParticipantTest.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Result/Item/Participant.php b/src/Result/Item/Participant.php index 17f02dd..6d87f1f 100644 --- a/src/Result/Item/Participant.php +++ b/src/Result/Item/Participant.php @@ -199,7 +199,12 @@ class Participant extends BaseItem break; case 'completed': - $this->completed = 'Y' === trim(strtoupper($value)); + if ('N' === trim(strtoupper($value))) { + $this->completed = false; + break; + } + + $this->completed = Date::isValidDate($value, true); break; case 'usesleft': diff --git a/tests/Result/Item/ParticipantTest.php b/tests/Result/Item/ParticipantTest.php index eddd4e9..b45b61c 100644 --- a/tests/Result/Item/ParticipantTest.php +++ b/tests/Result/Item/ParticipantTest.php @@ -200,7 +200,7 @@ class ParticipantTest extends BaseTestCase 'sent' => 'Y', 'remindersent' => 'N', 'remindercount' => 1, - 'completed' => 'Y', + 'completed' => (new DateTime())->format('Y-m-d H:i'), 'usesleft' => 5, 'validfrom' => (new DateTime())->format('Y-m-d H:i:s'), 'validuntil' => null,