{"action":"created","comment":{"url":"https://api.github.com/repos/aces/Loris/pulls/comments/86358323","pull_request_review_id":7020398,"id":86358323,"diff_hunk":"@@ -51,24 +53,178 @@\n $candidate = new Candidate();\n $candidate->select($DCCID); //find the candidate with the given DCCID\n \n+//Find Issues id with candidate foreign key\n+$issueIDs = $DB->pselect(\"SELECT issueID \n+                FROM issues \n+                WHERE candID=:candID\",\n+                array('candID' => $DCCID)\n+\t\t);\n+\n+//delete issues_comments\n+//delete issues_history\n+foreach ($issueIDs as $issueID) {\n+$DB->delete(\"issues_comments\", array(\"issueID\" => $issueID['issueID']));  \n+$DB->delete(\"issues_history\", array(\"issueID\" => $issueID['issueID'])); \n+};\n+echo \"----------------------delete issues_comments-------------------\\n\";  \n+echo \"----------------------delete issues_history--------------------\\n\";\n //find sessions\n $sessions = $candidate->getListOfTimePoints();\n if (is_null($sessions) || empty($sessions)) {\n     echo \"There are no coressponding session for Candid : $DCCID \\n\";\n     die();\n }\n-\n-echo \"Dropping all DB entries for candidate DCCID: \" . $DCCID . \"And PSCID:\" .\n-$PSCID. \"\\n\";\n+//delete from issues\n+$DB->delete(\"issues\", array(\"CandID\" => $DCCID));\n+echo \"----------------------delete  issues---------------------------\\n\";\n \n //find the test_names and commentIDs\n $query = \"SELECT ID, Test_name, CommentID FROM flag WHERE SessionID in (\" . \n          implode(\" , \", $sessions) . \")\";\n $instruments = $DB->pselect($query, array()); \n+//delete from genomic_candidate_files_rel\n+$DB->delete(\"genomic_candidate_files_rel\", array(\"CandID\" => $DCCID));\n+echo \"----------------------delete genomic_candidate_files_rel-------\\n\";\n+\n+//delete from genomic_cpg\n+$sample_labels = $DB->pselect(\"SELECT sample_label \n+                FROM genomic_sample_candidate_rel \n+                WHERE candID=:candID\",\n+                array('candID' => $DCCID)\n+                );\n+\n+foreach ($sample_labels as $sample_label) {\n+         $DB->delete(\"genomic_cpg\", \n+                 array(\"sample_label\" => $sample_label['sample_label']));      \n+};\n+echo \"----------------------delete genomic_cpg----------------------\\n\";\n+\n+\n+//delete from genomic_sample_candidate_rel\n+$DB->delete(\"genomic_sample_candidate_rel\", array(\"CandID\" => $DCCID));\n+echo \"----------------------delete genomic_sample_candidate_rel------\\n\";\n+\n+//to do: for deleting  mri_scanner\n+$mri_scannerIDs = $DB->pselect(\"SELECT ID \n+                FROM mri_scanner \n+                WHERE candID=:candID\",\n+                array('candID' => $DCCID)\n+                );\n+\n+foreach ($mri_scannerIDs as $mri_scannerID) {\n+      $DB->delete(\"mri_protocol\",\n+                           array(\"ScannerID\" => $mri_scannerID['ID']));\n+\n+      $fileIDs = $DB->pselect(\"SELECT FileID \n+                FROM files \n+                WHERE ScannerID=:ScannerID\",\n+                array('ScannerID' => $mri_scannerID['ID'])\n+                );      \n+      \n+      foreach ($fileIDs as $fileID) {\n+      \n+      $DB->delete(\"feedback_mri_comments\",\n+                           array(\"FileID\" => $FileID['FileID']));\n+      $DB->delete(\"files_intermediary\",\n+                           array(\"Input_FileID\" => $FileID['FileID']));","path":"tools/delete_candidate.php","position":98,"original_position":98,"commit_id":"cb842c51aa3c3dcc8050b0301eebc7d961ca4d19","original_commit_id":"cb842c51aa3c3dcc8050b0301eebc7d961ca4d19","user":{"login":"xlecours","id":12155214,"avatar_url":"https://avatars.githubusercontent.com/u/12155214?v=3","gravatar_id":"","url":"https://api.github.com/users/xlecours","html_url":"https://github.com/xlecours","followers_url":"https://api.github.com/users/xlecours/followers","following_url":"https://api.github.com/users/xlecours/following{/other_user}","gists_url":"https://api.github.com/users/xlecours/gists{/gist_id}","starred_url":"https://api.github.com/users/xlecours/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xlecours/subscriptions","organizations_url":"https://api.github.com/users/xlecours/orgs","repos_url":"https://api.github.com/users/xlecours/repos","events_url":"https://api.github.com/users/xlecours/events{/privacy}","received_events_url":"https://api.github.com/users/xlecours/received_events","type":"User","site_admin":false},"body":"FileID ---> fileID","created_at":"2016-11-03T14:42:48Z","updated_at":"2016-11-03T14:42:48Z","html_url":"https://github.com/aces/Loris/pull/2388#discussion_r86358323","pull_request_url":"https://api.github.com/repos/aces/Loris/pulls/2388","_links":{"self":{"href":"https://api.github.com/repos/aces/Loris/pulls/comments/86358323"},"html":{"href":"https://github.com/aces/Loris/pull/2388#discussion_r86358323"},"pull_request":{"href":"https://api.github.com/repos/aces/Loris/pulls/2388"}}},"pull_request":{"url":"https://api.github.com/repos/aces/Loris/pulls/2388","id":91666572,"html_url":"https://github.com/aces/Loris/pull/2388","diff_url":"https://github.com/aces/Loris/pull/2388.diff","patch_url":"https://github.com/aces/Loris/pull/2388.patch","issue_url":"https://api.github.com/repos/aces/Loris/issues/2388","number":2388,"state":"open","locked":false,"title":"[tools delete_candidate]Bug #11259","user":{"login":"kongtiaowang","id":9876007,"avatar_url":"https://avatars.githubusercontent.com/u/9876007?v=3","gravatar_id":"","url":"https://api.github.com/users/kongtiaowang","html_url":"https://github.com/kongtiaowang","followers_url":"https://api.github.com/users/kongtiaowang/followers","following_url":"https://api.github.com/users/kongtiaowang/following{/other_user}","gists_url":"https://api.github.com/users/kongtiaowang/gists{/gist_id}","starred_url":"https://api.github.com/users/kongtiaowang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kongtiaowang/subscriptions","organizations_url":"https://api.github.com/users/kongtiaowang/orgs","repos_url":"https://api.github.com/users/kongtiaowang/repos","events_url":"https://api.github.com/users/kongtiaowang/events{/privacy}","received_events_url":"https://api.github.com/users/kongtiaowang/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-31T18:44:51Z","updated_at":"2016-11-03T14:42:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b39a7a4d64d29fefb8601a5a889bfde239c00910","assignee":{"login":"xlecours","id":12155214,"avatar_url":"https://avatars.githubusercontent.com/u/12155214?v=3","gravatar_id":"","url":"https://api.github.com/users/xlecours","html_url":"https://github.com/xlecours","followers_url":"https://api.github.com/users/xlecours/followers","following_url":"https://api.github.com/users/xlecours/following{/other_user}","gists_url":"https://api.github.com/users/xlecours/gists{/gist_id}","starred_url":"https://api.github.com/users/xlecours/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xlecours/subscriptions","organizations_url":"https://api.github.com/users/xlecours/orgs","repos_url":"https://api.github.com/users/xlecours/repos","events_url":"https://api.github.com/users/xlecours/events{/privacy}","received_events_url":"https://api.github.com/users/xlecours/received_events","type":"User","site_admin":false},"assignees":[{"login":"xlecours","id":12155214,"avatar_url":"https://avatars.githubusercontent.com/u/12155214?v=3","gravatar_id":"","url":"https://api.github.com/users/xlecours","html_url":"https://github.com/xlecours","followers_url":"https://api.github.com/users/xlecours/followers","following_url":"https://api.github.com/users/xlecours/following{/other_user}","gists_url":"https://api.github.com/users/xlecours/gists{/gist_id}","starred_url":"https://api.github.com/users/xlecours/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xlecours/subscriptions","organizations_url":"https://api.github.com/users/xlecours/orgs","repos_url":"https://api.github.com/users/xlecours/repos","events_url":"https://api.github.com/users/xlecours/events{/privacy}","received_events_url":"https://api.github.com/users/xlecours/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/aces/Loris/milestones/9","html_url":"https://github.com/aces/Loris/milestones/17.0","labels_url":"https://api.github.com/repos/aces/Loris/milestones/9/labels","id":1620545,"number":9,"title":"17.0","description":"","creator":{"login":"driusan","id":498329,"avatar_url":"https://avatars.githubusercontent.com/u/498329?v=3","gravatar_id":"","url":"https://api.github.com/users/driusan","html_url":"https://github.com/driusan","followers_url":"https://api.github.com/users/driusan/followers","following_url":"https://api.github.com/users/driusan/following{/other_user}","gists_url":"https://api.github.com/users/driusan/gists{/gist_id}","starred_url":"https://api.github.com/users/driusan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/driusan/subscriptions","organizations_url":"https://api.github.com/users/driusan/orgs","repos_url":"https://api.github.com/users/driusan/repos","events_url":"https://api.github.com/users/driusan/events{/privacy}","received_events_url":"https://api.github.com/users/driusan/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":308,"state":"open","created_at":"2016-03-03T16:19:29Z","updated_at":"2016-11-02T20:58:51Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/aces/Loris/pulls/2388/commits","review_comments_url":"https://api.github.com/repos/aces/Loris/pulls/2388/comments","review_comment_url":"https://api.github.com/repos/aces/Loris/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aces/Loris/issues/2388/comments","statuses_url":"https://api.github.com/repos/aces/Loris/statuses/cb842c51aa3c3dcc8050b0301eebc7d961ca4d19","head":{"label":"kongtiaowang:2016-10-31","ref":"2016-10-31","sha":"cb842c51aa3c3dcc8050b0301eebc7d961ca4d19","user":{"login":"kongtiaowang","id":9876007,"avatar_url":"https://avatars.githubusercontent.com/u/9876007?v=3","gravatar_id":"","url":"https://api.github.com/users/kongtiaowang","html_url":"https://github.com/kongtiaowang","followers_url":"https://api.github.com/users/kongtiaowang/followers","following_url":"https://api.github.com/users/kongtiaowang/following{/other_user}","gists_url":"https://api.github.com/users/kongtiaowang/gists{/gist_id}","starred_url":"https://api.github.com/users/kongtiaowang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kongtiaowang/subscriptions","organizations_url":"https://api.github.com/users/kongtiaowang/orgs","repos_url":"https://api.github.com/users/kongtiaowang/repos","events_url":"https://api.github.com/users/kongtiaowang/events{/privacy}","received_events_url":"https://api.github.com/users/kongtiaowang/received_events","type":"User","site_admin":false},"repo":{"id":50038880,"name":"Loris","full_name":"kongtiaowang/Loris","owner":{"login":"kongtiaowang","id":9876007,"avatar_url":"https://avatars.githubusercontent.com/u/9876007?v=3","gravatar_id":"","url":"https://api.github.com/users/kongtiaowang","html_url":"https://github.com/kongtiaowang","followers_url":"https://api.github.com/users/kongtiaowang/followers","following_url":"https://api.github.com/users/kongtiaowang/following{/other_user}","gists_url":"https://api.github.com/users/kongtiaowang/gists{/gist_id}","starred_url":"https://api.github.com/users/kongtiaowang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kongtiaowang/subscriptions","organizations_url":"https://api.github.com/users/kongtiaowang/orgs","repos_url":"https://api.github.com/users/kongtiaowang/repos","events_url":"https://api.github.com/users/kongtiaowang/events{/privacy}","received_events_url":"https://api.github.com/users/kongtiaowang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kongtiaowang/Loris","description":"LORIS is a web-accessible database solution for longitudinal multi-site studies.","fork":true,"url":"https://api.github.com/repos/kongtiaowang/Loris","forks_url":"https://api.github.com/repos/kongtiaowang/Loris/forks","keys_url":"https://api.github.com/repos/kongtiaowang/Loris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kongtiaowang/Loris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kongtiaowang/Loris/teams","hooks_url":"https://api.github.com/repos/kongtiaowang/Loris/hooks","issue_events_url":"https://api.github.com/repos/kongtiaowang/Loris/issues/events{/number}","events_url":"https://api.github.com/repos/kongtiaowang/Loris/events","assignees_url":"https://api.github.com/repos/kongtiaowang/Loris/assignees{/user}","branches_url":"https://api.github.com/repos/kongtiaowang/Loris/branches{/branch}","tags_url":"https://api.github.com/repos/kongtiaowang/Loris/tags","blobs_url":"https://api.github.com/repos/kongtiaowang/Loris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kongtiaowang/Loris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kongtiaowang/Loris/git/refs{/sha}","trees_url":"https://api.github.com/repos/kongtiaowang/Loris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kongtiaowang/Loris/statuses/{sha}","languages_url":"https://api.github.com/repos/kongtiaowang/Loris/languages","stargazers_url":"https://api.github.com/repos/kongtiaowang/Loris/stargazers","contributors_url":"https://api.github.com/repos/kongtiaowang/Loris/contributors","subscribers_url":"https://api.github.com/repos/kongtiaowang/Loris/subscribers","subscription_url":"https://api.github.com/repos/kongtiaowang/Loris/subscription","commits_url":"https://api.github.com/repos/kongtiaowang/Loris/commits{/sha}","git_commits_url":"https://api.github.com/repos/kongtiaowang/Loris/git/commits{/sha}","comments_url":"https://api.github.com/repos/kongtiaowang/Loris/comments{/number}","issue_comment_url":"https://api.github.com/repos/kongtiaowang/Loris/issues/comments{/number}","contents_url":"https://api.github.com/repos/kongtiaowang/Loris/contents/{+path}","compare_url":"https://api.github.com/repos/kongtiaowang/Loris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kongtiaowang/Loris/merges","archive_url":"https://api.github.com/repos/kongtiaowang/Loris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kongtiaowang/Loris/downloads","issues_url":"https://api.github.com/repos/kongtiaowang/Loris/issues{/number}","pulls_url":"https://api.github.com/repos/kongtiaowang/Loris/pulls{/number}","milestones_url":"https://api.github.com/repos/kongtiaowang/Loris/milestones{/number}","notifications_url":"https://api.github.com/repos/kongtiaowang/Loris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kongtiaowang/Loris/labels{/name}","releases_url":"https://api.github.com/repos/kongtiaowang/Loris/releases{/id}","deployments_url":"https://api.github.com/repos/kongtiaowang/Loris/deployments","created_at":"2016-01-20T15:24:24Z","updated_at":"2016-03-10T20:04:00Z","pushed_at":"2016-11-01T18:34:43Z","git_url":"git://github.com/kongtiaowang/Loris.git","ssh_url":"git@github.com:kongtiaowang/Loris.git","clone_url":"https://github.com/kongtiaowang/Loris.git","svn_url":"https://github.com/kongtiaowang/Loris","homepage":"","size":67618,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"17.0-dev"}},"base":{"label":"aces:17.0-dev","ref":"17.0-dev","sha":"ef857e586eaddaaedf44ab09297e3b5e50dce12b","user":{"login":"aces","id":472868,"avatar_url":"https://avatars.githubusercontent.com/u/472868?v=3","gravatar_id":"","url":"https://api.github.com/users/aces","html_url":"https://github.com/aces","followers_url":"https://api.github.com/users/aces/followers","following_url":"https://api.github.com/users/aces/following{/other_user}","gists_url":"https://api.github.com/users/aces/gists{/gist_id}","starred_url":"https://api.github.com/users/aces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aces/subscriptions","organizations_url":"https://api.github.com/users/aces/orgs","repos_url":"https://api.github.com/users/aces/repos","events_url":"https://api.github.com/users/aces/events{/privacy}","received_events_url":"https://api.github.com/users/aces/received_events","type":"Organization","site_admin":false},"repo":{"id":1125630,"name":"Loris","full_name":"aces/Loris","owner":{"login":"aces","id":472868,"avatar_url":"https://avatars.githubusercontent.com/u/472868?v=3","gravatar_id":"","url":"https://api.github.com/users/aces","html_url":"https://github.com/aces","followers_url":"https://api.github.com/users/aces/followers","following_url":"https://api.github.com/users/aces/following{/other_user}","gists_url":"https://api.github.com/users/aces/gists{/gist_id}","starred_url":"https://api.github.com/users/aces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aces/subscriptions","organizations_url":"https://api.github.com/users/aces/orgs","repos_url":"https://api.github.com/users/aces/repos","events_url":"https://api.github.com/users/aces/events{/privacy}","received_events_url":"https://api.github.com/users/aces/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aces/Loris","description":"LORIS is a web-accessible database solution for longitudinal multi-site studies.","fork":false,"url":"https://api.github.com/repos/aces/Loris","forks_url":"https://api.github.com/repos/aces/Loris/forks","keys_url":"https://api.github.com/repos/aces/Loris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aces/Loris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aces/Loris/teams","hooks_url":"https://api.github.com/repos/aces/Loris/hooks","issue_events_url":"https://api.github.com/repos/aces/Loris/issues/events{/number}","events_url":"https://api.github.com/repos/aces/Loris/events","assignees_url":"https://api.github.com/repos/aces/Loris/assignees{/user}","branches_url":"https://api.github.com/repos/aces/Loris/branches{/branch}","tags_url":"https://api.github.com/repos/aces/Loris/tags","blobs_url":"https://api.github.com/repos/aces/Loris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aces/Loris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aces/Loris/git/refs{/sha}","trees_url":"https://api.github.com/repos/aces/Loris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aces/Loris/statuses/{sha}","languages_url":"https://api.github.com/repos/aces/Loris/languages","stargazers_url":"https://api.github.com/repos/aces/Loris/stargazers","contributors_url":"https://api.github.com/repos/aces/Loris/contributors","subscribers_url":"https://api.github.com/repos/aces/Loris/subscribers","subscription_url":"https://api.github.com/repos/aces/Loris/subscription","commits_url":"https://api.github.com/repos/aces/Loris/commits{/sha}","git_commits_url":"https://api.github.com/repos/aces/Loris/git/commits{/sha}","comments_url":"https://api.github.com/repos/aces/Loris/comments{/number}","issue_comment_url":"https://api.github.com/repos/aces/Loris/issues/comments{/number}","contents_url":"https://api.github.com/repos/aces/Loris/contents/{+path}","compare_url":"https://api.github.com/repos/aces/Loris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aces/Loris/merges","archive_url":"https://api.github.com/repos/aces/Loris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aces/Loris/downloads","issues_url":"https://api.github.com/repos/aces/Loris/issues{/number}","pulls_url":"https://api.github.com/repos/aces/Loris/pulls{/number}","milestones_url":"https://api.github.com/repos/aces/Loris/milestones{/number}","notifications_url":"https://api.github.com/repos/aces/Loris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aces/Loris/labels{/name}","releases_url":"https://api.github.com/repos/aces/Loris/releases{/id}","deployments_url":"https://api.github.com/repos/aces/Loris/deployments","created_at":"2010-11-30T14:57:57Z","updated_at":"2016-10-25T14:32:57Z","pushed_at":"2016-11-02T20:58:51Z","git_url":"git://github.com/aces/Loris.git","ssh_url":"git@github.com:aces/Loris.git","clone_url":"https://github.com/aces/Loris.git","svn_url":"https://github.com/aces/Loris","homepage":"","size":71738,"stargazers_count":36,"watchers_count":36,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":18,"forks":61,"open_issues":18,"watchers":36,"default_branch":"17.1-dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aces/Loris/pulls/2388"},"html":{"href":"https://github.com/aces/Loris/pull/2388"},"issue":{"href":"https://api.github.com/repos/aces/Loris/issues/2388"},"comments":{"href":"https://api.github.com/repos/aces/Loris/issues/2388/comments"},"review_comments":{"href":"https://api.github.com/repos/aces/Loris/pulls/2388/comments"},"review_comment":{"href":"https://api.github.com/repos/aces/Loris/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aces/Loris/pulls/2388/commits"},"statuses":{"href":"https://api.github.com/repos/aces/Loris/statuses/cb842c51aa3c3dcc8050b0301eebc7d961ca4d19"}}}}
{"actor":{"display_login":"xlecours"}}