From 27e7432176ca58cab122c7ba5e0fb1ffbea4d45d Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Wed, 9 Aug 2023 11:51:34 -0400 Subject: [PATCH 1/3] [LINST] fix survey and date issues --- .../NDB_BVL_Instrument_LINST.class.inc | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/php/libraries/NDB_BVL_Instrument_LINST.class.inc b/php/libraries/NDB_BVL_Instrument_LINST.class.inc index 495843a4358..bc62bf8ad2c 100644 --- a/php/libraries/NDB_BVL_Instrument_LINST.class.inc +++ b/php/libraries/NDB_BVL_Instrument_LINST.class.inc @@ -98,7 +98,9 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument ] ); - if (strrpos($this->testName ?? '', '_proband') === false) { + if (strrpos($this->testName ?? '', '_proband') === false + && !$this->DataEntryType == 'DirectEntry' + ) { if (!$this->postMortem) { $this->addScoreColumn( 'Candidate_Age', @@ -675,7 +677,10 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument // The question should be added to the LinstQuestions in this // order, before the _date is stripped below for standard // dates to allow XINValidation to recognize the field name - $this->LinstQuestions[$pieces[1]] = ['type' => 'date']; + $this->LinstQuestions[$pieces[1]] = [ + 'type' => 'date', + 'dateFormat' => $dateFormat, + ]; if ($dateFormat === 'MonthYear') { // Shows date without day of month @@ -978,15 +983,27 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument $q['UserRules'] = true; switch ($q['type']) { + // Selects (including multiselects), Basic Dates and MonthYears + // are the only type of rules that aren't part of a group + // the rest include a _status element case 'select': - // Selects are the only type of rules that aren't part - // of a group, the rest include a _status element $this->XINRegisterRule($question, $rules, $message); break; + case 'date': + if ($q['dateFormat'] === 'BasicDate' + || $q['dateFormat'] === 'MonthYear' + ) { + $this->XINRegisterRule($question, $rules, $message); + break; + } default: + $rules_array = array_merge( + $rules, + [$question.'_status{@}=={@}'] + ); $this->XINRegisterRule( $question, - $rules, + $rules_array, $message, $question . "_group" ); @@ -1015,7 +1032,7 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument "InstrumentFormatVersion" => "v0.0.1a-dev", "ShortName" => "", "LongName" => "", - "IncludeMetaDataFields" => "true", + "IncludeMetaDataFields" => "false", ], 'Elements' => [], ]; From 1cb67b9dac23062107decad141019bbc5b87b965 Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Wed, 9 Aug 2023 11:55:09 -0400 Subject: [PATCH 2/3] Update NDB_BVL_Instrument_LINST.class.inc --- php/libraries/NDB_BVL_Instrument_LINST.class.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/libraries/NDB_BVL_Instrument_LINST.class.inc b/php/libraries/NDB_BVL_Instrument_LINST.class.inc index bc62bf8ad2c..70f37eaccde 100644 --- a/php/libraries/NDB_BVL_Instrument_LINST.class.inc +++ b/php/libraries/NDB_BVL_Instrument_LINST.class.inc @@ -1032,7 +1032,7 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument "InstrumentFormatVersion" => "v0.0.1a-dev", "ShortName" => "", "LongName" => "", - "IncludeMetaDataFields" => "false", + "IncludeMetaDataFields" => "true", ], 'Elements' => [], ]; From 5f867718dc8c6b911b2a9edd5ba6139b8157f4d6 Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Thu, 10 Aug 2023 17:19:17 -0400 Subject: [PATCH 3/3] Update NDB_BVL_Instrument_LINST.class.inc --- php/libraries/NDB_BVL_Instrument_LINST.class.inc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/php/libraries/NDB_BVL_Instrument_LINST.class.inc b/php/libraries/NDB_BVL_Instrument_LINST.class.inc index 70f37eaccde..fbebdd2b13d 100644 --- a/php/libraries/NDB_BVL_Instrument_LINST.class.inc +++ b/php/libraries/NDB_BVL_Instrument_LINST.class.inc @@ -98,9 +98,7 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument ] ); - if (strrpos($this->testName ?? '', '_proband') === false - && !$this->DataEntryType == 'DirectEntry' - ) { + if (strrpos($this->testName ?? '', '_proband') === false) { if (!$this->postMortem) { $this->addScoreColumn( 'Candidate_Age',