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

[instruments] Remove CommentID from getInstanceData. #8805

Merged
merged 2 commits into from
Jun 21, 2023
Merged
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
7 changes: 6 additions & 1 deletion php/libraries/NDB_BVL_Instrument.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2106,12 +2106,17 @@ abstract class NDB_BVL_Instrument extends NDB_Page
['CID' => $this->getCommentID()]
);

$this->instanceData = json_decode($jsondata, true) ?? [];
$this->instanceData = json_decode($jsondata ?? '', true) ?? [];
} else {
$defaults = $db->pselectRow(
"SELECT * FROM $this->table WHERE CommentID=:CID",
['CID' => $this->getCommentID()]
);
// This is only included because it's the primary key. JSON
// data does not include it. Unset so that the two types are
// consistent. Places that need the commentID should be using
// NDB_BVL_Instrument->getCommentID()
unset($defaults['CommentID']);

$this->instanceData = $defaults ?? [];
}
Expand Down
1 change: 0 additions & 1 deletion test/unittests/NDB_BVL_Instrument_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,6 @@ function testGetInstanceData()
'ID' => '1000',
'SessionID' => '123',
'Test_name' => 'Test_name1',
'CommentID' => 'commentID1',
'Data_entry' => '',
'Required_elements_completed' => 'N',
'Administration' => '',
Expand Down