Skip to content

Commit

Permalink
[conflict_resolver] Rename TableName to TestName
Browse files Browse the repository at this point in the history
  • Loading branch information
CamilleBeau committed May 16, 2024
1 parent e6204b3 commit 654a847
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
5 changes: 5 additions & 0 deletions SQL/New_patches/2024-05-16-conflict-resolver-use-testname.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE conflicts_resolved
CHANGE `TableName` `TestName` varchar(255) NOT NULL;

ALTER TABLE conflicts_unresolved
CHANGE `TableName` `TestName` varchar(255) NOT NULL;
16 changes: 8 additions & 8 deletions modules/conflict_resolver/php/endpoints/unresolved.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class Unresolved extends Endpoint implements ETagCalculator
$conflict = $db->pselectRow(
'
SELECT
TableName,
TestName,
FieldName,
CommentId1 as CID1,
CommentId2 as CID2,
Expand All @@ -217,7 +217,7 @@ class Unresolved extends Endpoint implements ETagCalculator
ConflictID = :v_conflictid
UNION DISTINCT
SELECT
TableName,
TestName,
FieldName,
CommentId1 as CID1,
CommentId2 as CID2,
Expand Down Expand Up @@ -247,14 +247,14 @@ class Unresolved extends Endpoint implements ETagCalculator

$instrument = \NDB_BVL_Instrument::factory(
$loris,
$conflict['TableName'],
$conflict['TestName'],
$conflict['CID1'],
'',
true
);
if ($instrument->_hasAccess($user) == false) {
return new \LORIS\Http\Response\JSON\Forbidden(
'Permission denied for ' . $conflict['TableName']
'Permission denied for ' . $conflict['TestName']
);
}
$instrument->_saveValues(
Expand All @@ -263,7 +263,7 @@ class Unresolved extends Endpoint implements ETagCalculator

$ddeinstrument = \NDB_BVL_Instrument::factory(
$loris,
$conflict['TableName'],
$conflict['TestName'],
$conflict['CID2'],
'',
true
Expand Down Expand Up @@ -292,7 +292,7 @@ class Unresolved extends Endpoint implements ETagCalculator
UserID,
User1,
User2,
TableName,
TestName,
ExtraKeyColumn,
ExtraKey1,
ExtraKey2,
Expand All @@ -308,7 +308,7 @@ class Unresolved extends Endpoint implements ETagCalculator
:v_username,
f1.UserID,
f2.UserID,
cu.TableName,
cu.TestName,
cu.ExtraKeyColumn,
cu.ExtraKey1,
cu.ExtraKey2,
Expand All @@ -330,7 +330,7 @@ class Unresolved extends Endpoint implements ETagCalculator
:v_username,
cr.User1,
cr.User2,
cr.TableName,
cr.TestName,
cr.ExtraKeyColumn,
cr.ExtraKey1,
cr.ExtraKey2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ResolvedProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisioner
'
SELECT
conflicts_resolved.ResolvedID as resolvedid,
conflicts_resolved.TableName as instrument,
conflicts_resolved.TestName as instrument,
session.CandID as candid,
candidate.PSCID as pscid,
session.Visit_label as visitlabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class UnresolvedProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisioner
'
SELECT
conflicts_unresolved.ConflictID as conflictid,
conflicts_unresolved.TableName as instrument,
conflicts_unresolved.TestName as instrument,
session.CandID as candid,
candidate.PSCID as pscid,
session.Visit_label as visitlabel,
Expand Down
2 changes: 1 addition & 1 deletion modules/conflict_resolver/test/conflict_resolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function tearDown(): void
$this->DB->insert(
"conflicts_unresolved",
[
'TableName' => 'radiology_review',
'TestName' => 'radiology_review',
'FieldName' => 'Scan_done',
'CommentId1' => '475906DCC4222142111524502652',
'Value1' => 'yes',
Expand Down
3 changes: 2 additions & 1 deletion php/libraries/ConflictDetector.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ConflictDetector
{
$db = \NDB_Factory::singleton()->database();
foreach ($diffResult as $diffLine) {
print_r($diffLine);
$db->replace('conflicts_unresolved', $diffLine);
}

Expand All @@ -110,7 +111,7 @@ class ConflictDetector
function clearConflictsForField(array $diffLine): void
{
$deleteWhere = [
'TableName' => $diffLine['TableName'],
'testName' => $diffLine['TestName'],
'ExtraKeyColumn' => $diffLine['ExtraKeyColumn'],
'ExtraKey1' => $diffLine['ExtraKey1'],
'ExtraKey2' => $diffLine['ExtraKey2'],
Expand Down
2 changes: 1 addition & 1 deletion php/libraries/NDB_BVL_Instrument.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ abstract class NDB_BVL_Instrument extends NDB_Page
if (!in_array($key, $this->_doubleDataEntryDiffIgnoreColumns)) {
if ($otherData[$key] != $value) {
$diff[] = [
'TableName' => $this->table,
'TestName' => $this->testName,
'ExtraKeyColumn' => null,
'ExtraKey1' => ' ',
'ExtraKey2' => ' ',
Expand Down
4 changes: 2 additions & 2 deletions test/unittests/NDB_BVL_Instrument_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ function testDiff()
$this->_instrument->diff($otherInstrument),
[
[
'TableName' => 'medical_history',
'TestName' => 'medical_history',
'ExtraKeyColumn' => null,
'ExtraKey1' => ' ',
'ExtraKey2' => ' ',
Expand Down Expand Up @@ -1652,7 +1652,7 @@ function testClearInstrument()
$conflicts_data = [
[
'ConflictID' => '123',
'TableName' => '',
'TestName' => '',
'ExtraKeyColumn' => null,
'ExtraKey1' => '',
'ExtraKey2' => '',
Expand Down

0 comments on commit 654a847

Please sign in to comment.