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

[Instrument] Add support for jsonData instrument in clearInstrument function #7484

Merged
merged 2 commits into from
Jun 16, 2021
Merged
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
44 changes: 25 additions & 19 deletions php/libraries/NDB_BVL_Instrument.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2300,29 +2300,35 @@ abstract class NDB_BVL_Instrument extends NDB_Page
$config = NDB_Config::singleton();
$db = Database::singleton();
$dbconfig = $config->getSetting('database');
$columns = $db->pselect(
"SELECT COLUMN_NAME FROM information_schema.columns

if (!$this->jsonData) {
$columns = $db->pselect(
"SELECT COLUMN_NAME FROM information_schema.columns
WHERE TABLE_NAME=:table AND TABLE_SCHEMA=:db",
array(
'table' => $this->table,
'db' => $dbconfig['database'],
)
);
array(
'table' => $this->table,
'db' => $dbconfig['database'],
)
);

$values = array();
foreach ($columns as $row) {
switch ($row['COLUMN_NAME']) {
case 'CommentID':
case 'UserID':
continue 2;
case 'Data_entry_completion_status':
$values[$row['COLUMN_NAME']] = 'Incomplete';
break;
default:
$values[$row['COLUMN_NAME']] = null;
$values = array();
foreach ($columns as $row) {
switch ($row['COLUMN_NAME']) {
case 'CommentID':
case 'UserID':
continue 2;
case 'Data_entry_completion_status':
$values[$row['COLUMN_NAME']] = 'Incomplete';
break;
default:
$values[$row['COLUMN_NAME']] = null;
}
}
$db->update($this->table, $values, ['CommentID' => $this->commentID]);
}
$db->update($this->table, $values, array('CommentID' => $this->commentID));

// Clear data out of the flag table's Data column
$db->update('flag', ['Data'=>null], ['CommentID' => $this->commentID]);
$prepQ = $db->prepare(
"DELETE FROM conflicts_unresolved
WHERE (CommentId1=:CID OR CommentId2=:CID)"
Expand Down