Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LINST] skip metadatafields for surveys #8863

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion php/libraries/NDB_BVL_Instrument.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,11 @@ abstract class NDB_BVL_Instrument extends NDB_Page
*/
function _saveValues(array $values): void
{
if (strrpos($this->testName, "_proband") === false) {
// Surveys do not ask for the metadata informatio nand thus date_taken is
// always null so there is no use in going into the savecandidateage function
if (strrpos($this->testName, "_proband") === false
&& $this->DataEntryType === 'normal'
zaliqarosli marked this conversation as resolved.
Show resolved Hide resolved
) {
$this->_saveCandidateAge($values);
}

Expand Down
4 changes: 3 additions & 1 deletion php/libraries/NDB_BVL_Instrument_LINST.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,9 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
'instrument_title',
$pieces[1]
);
$this->_addMetadataFields();
if ($this->DataEntryType!=="DirectEntry") {
zaliqarosli marked this conversation as resolved.
Show resolved Hide resolved
$this->_addMetadataFields();
}
}
break;
case 'begingroup':
Expand Down
9 changes: 5 additions & 4 deletions test/unittests/NDB_BVL_Instrument_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1335,10 +1335,11 @@ function testSaveValueAndSave()
{
$this->_setUpMockDB();
$this->_setTableData();
$this->_instrument->commentID = 'commentID1';
$this->_instrument->table = 'medical_history';
$this->_instrument->testName = 'Test';
$this->_instrument->formType = "XIN";
$this->_instrument->commentID = 'commentID1';
$this->_instrument->table = 'medical_history';
$this->_instrument->testName = 'Test';
$this->_instrument->formType = "XIN";
$this->_instrument->DataEntryType = "normal";
$values = ['Date_taken' => '2005-06-06',
'arthritis_age' => 2,
'arthritis_age_status' => 'status'
Expand Down