{"action":"created","comment":{"url":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/comments/218427790","pull_request_review_id":156361468,"id":218427790,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODQyNzc5MA==","diff_hunk":"@@ -252,6 +252,51 @@ function plugin_escalade_install() {\n \n    $migration->migrationOneTable('glpi_plugin_escalade_configs');\n \n+   if (!$DB->fieldExists('glpi_plugin_escalade_histories', 'previous_groups_id')\n+      || ! !$DB->fieldExists(\"glpi_plugin_escalade_histories\", 'counter')) {\n+      $migration->addField('glpi_plugin_escalade_histories', 'previous_groups_id',\n+                           'integer', ['before' => 'groups_id']);\n+      $migration->addField('glpi_plugin_escalade_histories', 'counter',\n+                           'integer', ['after' => 'groups_id']);\n+      $migration->migrationOneTable('glpi_plugin_escalade_histories');\n+\n+      $history = new PluginEscaladeHistory();\n+      $histories = [];\n+      foreach ($history->find() as $data) {\n+         $tickets_id = $data['tickets_id'];\n+         unset($data['tickets_id']);\n+\n+         if (!isset($histories[$tickets_id])) {\n+            $histories[$tickets_id] = [];\n+         }\n+\n+         $histories[$tickets_id][] = $data;\n+      }\n+\n+      foreach ($histories as $tickets_id => $h) {\n+         echo 'Ticket #' . $tickets_id . '<br/>';\n+         $counters = [];\n+\n+         foreach ($h as $k => $details) {\n+            if (isset($h[$k+1])) {\n+               $first  = $h[$k+1]['groups_id'] < $details['groups_id'] ? $h[$k+1]['groups_id'] : $details['groups_id'];","path":"hook.php","position":31,"original_position":31,"commit_id":"dad2e20796caed5fd86be74323554eaf5414fed3","original_commit_id":"683f86f47ac807f856a9fa04170000442cc069b1","user":{"login":"Badoche1337","id":19470818,"node_id":"MDQ6VXNlcjE5NDcwODE4","avatar_url":"https://avatars2.githubusercontent.com/u/19470818?v=4","gravatar_id":"","url":"https://api.github.com/users/Badoche1337","html_url":"https://github.com/Badoche1337","followers_url":"https://api.github.com/users/Badoche1337/followers","following_url":"https://api.github.com/users/Badoche1337/following{/other_user}","gists_url":"https://api.github.com/users/Badoche1337/gists{/gist_id}","starred_url":"https://api.github.com/users/Badoche1337/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Badoche1337/subscriptions","organizations_url":"https://api.github.com/users/Badoche1337/orgs","repos_url":"https://api.github.com/users/Badoche1337/repos","events_url":"https://api.github.com/users/Badoche1337/events{/privacy}","received_events_url":"https://api.github.com/users/Badoche1337/received_events","type":"User","site_admin":false},"body":"The counter field is not number of escalations for the current group (this could be done in simple query), but the number of escalations betwteen current group (A) and the previous one (B), the numeric comparaison is just one way to ensure the key (in array) used to store current count of escalations betwteen the 2 current groups is the same, whatever which group has escalated to other in the current row. ","created_at":"2018-09-18T13:19:48Z","updated_at":"2018-09-18T13:19:48Z","html_url":"https://github.com/pluginsGLPI/escalade/pull/62#discussion_r218427790","pull_request_url":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/62","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/comments/218427790"},"html":{"href":"https://github.com/pluginsGLPI/escalade/pull/62#discussion_r218427790"},"pull_request":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/62"}},"in_reply_to_id":218402432},"pull_request":{"url":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/62","id":216008189,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2MDA4MTg5","html_url":"https://github.com/pluginsGLPI/escalade/pull/62","diff_url":"https://github.com/pluginsGLPI/escalade/pull/62.diff","patch_url":"https://github.com/pluginsGLPI/escalade/pull/62.patch","issue_url":"https://api.github.com/repos/pluginsGLPI/escalade/issues/62","number":62,"state":"open","locked":false,"title":"Improve history table with previous_groups_id field and counter field","user":{"login":"Badoche1337","id":19470818,"node_id":"MDQ6VXNlcjE5NDcwODE4","avatar_url":"https://avatars2.githubusercontent.com/u/19470818?v=4","gravatar_id":"","url":"https://api.github.com/users/Badoche1337","html_url":"https://github.com/Badoche1337","followers_url":"https://api.github.com/users/Badoche1337/followers","following_url":"https://api.github.com/users/Badoche1337/following{/other_user}","gists_url":"https://api.github.com/users/Badoche1337/gists{/gist_id}","starred_url":"https://api.github.com/users/Badoche1337/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Badoche1337/subscriptions","organizations_url":"https://api.github.com/users/Badoche1337/orgs","repos_url":"https://api.github.com/users/Badoche1337/repos","events_url":"https://api.github.com/users/Badoche1337/events{/privacy}","received_events_url":"https://api.github.com/users/Badoche1337/received_events","type":"User","site_admin":false},"body":"Hello,\r\n\r\nI want to add some informations in escalation history table :\r\n\r\nPrevious group assigned (Group A)\r\nCounter of escalations between Group A (previous) and Group B (new assigned group)\r\nNew search option : total number of escalations in one ticket\r\nNew search option : total number of escalations in one ticket between 2 distincts groups","created_at":"2018-09-17T14:46:25Z","updated_at":"2018-09-18T13:19:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62da362fb43cc738de3ad8538e40049c4c35e80d","assignee":null,"assignees":[],"requested_reviewers":[{"login":"orthagh","id":418844,"node_id":"MDQ6VXNlcjQxODg0NA==","avatar_url":"https://avatars2.githubusercontent.com/u/418844?v=4","gravatar_id":"","url":"https://api.github.com/users/orthagh","html_url":"https://github.com/orthagh","followers_url":"https://api.github.com/users/orthagh/followers","following_url":"https://api.github.com/users/orthagh/following{/other_user}","gists_url":"https://api.github.com/users/orthagh/gists{/gist_id}","starred_url":"https://api.github.com/users/orthagh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orthagh/subscriptions","organizations_url":"https://api.github.com/users/orthagh/orgs","repos_url":"https://api.github.com/users/orthagh/repos","events_url":"https://api.github.com/users/orthagh/events{/privacy}","received_events_url":"https://api.github.com/users/orthagh/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/62/commits","review_comments_url":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/62/comments","review_comment_url":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pluginsGLPI/escalade/issues/62/comments","statuses_url":"https://api.github.com/repos/pluginsGLPI/escalade/statuses/dad2e20796caed5fd86be74323554eaf5414fed3","head":{"label":"Badoche1337:feature/improve-escalation-history","ref":"feature/improve-escalation-history","sha":"dad2e20796caed5fd86be74323554eaf5414fed3","user":{"login":"Badoche1337","id":19470818,"node_id":"MDQ6VXNlcjE5NDcwODE4","avatar_url":"https://avatars2.githubusercontent.com/u/19470818?v=4","gravatar_id":"","url":"https://api.github.com/users/Badoche1337","html_url":"https://github.com/Badoche1337","followers_url":"https://api.github.com/users/Badoche1337/followers","following_url":"https://api.github.com/users/Badoche1337/following{/other_user}","gists_url":"https://api.github.com/users/Badoche1337/gists{/gist_id}","starred_url":"https://api.github.com/users/Badoche1337/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Badoche1337/subscriptions","organizations_url":"https://api.github.com/users/Badoche1337/orgs","repos_url":"https://api.github.com/users/Badoche1337/repos","events_url":"https://api.github.com/users/Badoche1337/events{/privacy}","received_events_url":"https://api.github.com/users/Badoche1337/received_events","type":"User","site_admin":false},"repo":{"id":123135595,"node_id":"MDEwOlJlcG9zaXRvcnkxMjMxMzU1OTU=","name":"escalade","full_name":"Badoche1337/escalade","private":false,"owner":{"login":"Badoche1337","id":19470818,"node_id":"MDQ6VXNlcjE5NDcwODE4","avatar_url":"https://avatars2.githubusercontent.com/u/19470818?v=4","gravatar_id":"","url":"https://api.github.com/users/Badoche1337","html_url":"https://github.com/Badoche1337","followers_url":"https://api.github.com/users/Badoche1337/followers","following_url":"https://api.github.com/users/Badoche1337/following{/other_user}","gists_url":"https://api.github.com/users/Badoche1337/gists{/gist_id}","starred_url":"https://api.github.com/users/Badoche1337/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Badoche1337/subscriptions","organizations_url":"https://api.github.com/users/Badoche1337/orgs","repos_url":"https://api.github.com/users/Badoche1337/repos","events_url":"https://api.github.com/users/Badoche1337/events{/privacy}","received_events_url":"https://api.github.com/users/Badoche1337/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Badoche1337/escalade","description":"GLPI Plugin escalade","fork":true,"url":"https://api.github.com/repos/Badoche1337/escalade","forks_url":"https://api.github.com/repos/Badoche1337/escalade/forks","keys_url":"https://api.github.com/repos/Badoche1337/escalade/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Badoche1337/escalade/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Badoche1337/escalade/teams","hooks_url":"https://api.github.com/repos/Badoche1337/escalade/hooks","issue_events_url":"https://api.github.com/repos/Badoche1337/escalade/issues/events{/number}","events_url":"https://api.github.com/repos/Badoche1337/escalade/events","assignees_url":"https://api.github.com/repos/Badoche1337/escalade/assignees{/user}","branches_url":"https://api.github.com/repos/Badoche1337/escalade/branches{/branch}","tags_url":"https://api.github.com/repos/Badoche1337/escalade/tags","blobs_url":"https://api.github.com/repos/Badoche1337/escalade/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Badoche1337/escalade/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Badoche1337/escalade/git/refs{/sha}","trees_url":"https://api.github.com/repos/Badoche1337/escalade/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Badoche1337/escalade/statuses/{sha}","languages_url":"https://api.github.com/repos/Badoche1337/escalade/languages","stargazers_url":"https://api.github.com/repos/Badoche1337/escalade/stargazers","contributors_url":"https://api.github.com/repos/Badoche1337/escalade/contributors","subscribers_url":"https://api.github.com/repos/Badoche1337/escalade/subscribers","subscription_url":"https://api.github.com/repos/Badoche1337/escalade/subscription","commits_url":"https://api.github.com/repos/Badoche1337/escalade/commits{/sha}","git_commits_url":"https://api.github.com/repos/Badoche1337/escalade/git/commits{/sha}","comments_url":"https://api.github.com/repos/Badoche1337/escalade/comments{/number}","issue_comment_url":"https://api.github.com/repos/Badoche1337/escalade/issues/comments{/number}","contents_url":"https://api.github.com/repos/Badoche1337/escalade/contents/{+path}","compare_url":"https://api.github.com/repos/Badoche1337/escalade/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Badoche1337/escalade/merges","archive_url":"https://api.github.com/repos/Badoche1337/escalade/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Badoche1337/escalade/downloads","issues_url":"https://api.github.com/repos/Badoche1337/escalade/issues{/number}","pulls_url":"https://api.github.com/repos/Badoche1337/escalade/pulls{/number}","milestones_url":"https://api.github.com/repos/Badoche1337/escalade/milestones{/number}","notifications_url":"https://api.github.com/repos/Badoche1337/escalade/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Badoche1337/escalade/labels{/name}","releases_url":"https://api.github.com/repos/Badoche1337/escalade/releases{/id}","deployments_url":"https://api.github.com/repos/Badoche1337/escalade/deployments","created_at":"2018-02-27T13:49:12Z","updated_at":"2018-09-17T09:13:57Z","pushed_at":"2018-09-18T13:06:17Z","git_url":"git://github.com/Badoche1337/escalade.git","ssh_url":"git@github.com:Badoche1337/escalade.git","clone_url":"https://github.com/Badoche1337/escalade.git","svn_url":"https://github.com/Badoche1337/escalade","homepage":"http://www.teclib-edition.com","size":370,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pluginsGLPI:develop","ref":"develop","sha":"46a73a524a9860ef20aa899cac7819e83ffb4bee","user":{"login":"pluginsGLPI","id":10156352,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMTU2MzUy","avatar_url":"https://avatars3.githubusercontent.com/u/10156352?v=4","gravatar_id":"","url":"https://api.github.com/users/pluginsGLPI","html_url":"https://github.com/pluginsGLPI","followers_url":"https://api.github.com/users/pluginsGLPI/followers","following_url":"https://api.github.com/users/pluginsGLPI/following{/other_user}","gists_url":"https://api.github.com/users/pluginsGLPI/gists{/gist_id}","starred_url":"https://api.github.com/users/pluginsGLPI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pluginsGLPI/subscriptions","organizations_url":"https://api.github.com/users/pluginsGLPI/orgs","repos_url":"https://api.github.com/users/pluginsGLPI/repos","events_url":"https://api.github.com/users/pluginsGLPI/events{/privacy}","received_events_url":"https://api.github.com/users/pluginsGLPI/received_events","type":"Organization","site_admin":false},"repo":{"id":35494334,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ5NDMzNA==","name":"escalade","full_name":"pluginsGLPI/escalade","private":false,"owner":{"login":"pluginsGLPI","id":10156352,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMTU2MzUy","avatar_url":"https://avatars3.githubusercontent.com/u/10156352?v=4","gravatar_id":"","url":"https://api.github.com/users/pluginsGLPI","html_url":"https://github.com/pluginsGLPI","followers_url":"https://api.github.com/users/pluginsGLPI/followers","following_url":"https://api.github.com/users/pluginsGLPI/following{/other_user}","gists_url":"https://api.github.com/users/pluginsGLPI/gists{/gist_id}","starred_url":"https://api.github.com/users/pluginsGLPI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pluginsGLPI/subscriptions","organizations_url":"https://api.github.com/users/pluginsGLPI/orgs","repos_url":"https://api.github.com/users/pluginsGLPI/repos","events_url":"https://api.github.com/users/pluginsGLPI/events{/privacy}","received_events_url":"https://api.github.com/users/pluginsGLPI/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pluginsGLPI/escalade","description":"GLPI Plugin escalade","fork":false,"url":"https://api.github.com/repos/pluginsGLPI/escalade","forks_url":"https://api.github.com/repos/pluginsGLPI/escalade/forks","keys_url":"https://api.github.com/repos/pluginsGLPI/escalade/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pluginsGLPI/escalade/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pluginsGLPI/escalade/teams","hooks_url":"https://api.github.com/repos/pluginsGLPI/escalade/hooks","issue_events_url":"https://api.github.com/repos/pluginsGLPI/escalade/issues/events{/number}","events_url":"https://api.github.com/repos/pluginsGLPI/escalade/events","assignees_url":"https://api.github.com/repos/pluginsGLPI/escalade/assignees{/user}","branches_url":"https://api.github.com/repos/pluginsGLPI/escalade/branches{/branch}","tags_url":"https://api.github.com/repos/pluginsGLPI/escalade/tags","blobs_url":"https://api.github.com/repos/pluginsGLPI/escalade/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pluginsGLPI/escalade/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pluginsGLPI/escalade/git/refs{/sha}","trees_url":"https://api.github.com/repos/pluginsGLPI/escalade/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pluginsGLPI/escalade/statuses/{sha}","languages_url":"https://api.github.com/repos/pluginsGLPI/escalade/languages","stargazers_url":"https://api.github.com/repos/pluginsGLPI/escalade/stargazers","contributors_url":"https://api.github.com/repos/pluginsGLPI/escalade/contributors","subscribers_url":"https://api.github.com/repos/pluginsGLPI/escalade/subscribers","subscription_url":"https://api.github.com/repos/pluginsGLPI/escalade/subscription","commits_url":"https://api.github.com/repos/pluginsGLPI/escalade/commits{/sha}","git_commits_url":"https://api.github.com/repos/pluginsGLPI/escalade/git/commits{/sha}","comments_url":"https://api.github.com/repos/pluginsGLPI/escalade/comments{/number}","issue_comment_url":"https://api.github.com/repos/pluginsGLPI/escalade/issues/comments{/number}","contents_url":"https://api.github.com/repos/pluginsGLPI/escalade/contents/{+path}","compare_url":"https://api.github.com/repos/pluginsGLPI/escalade/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pluginsGLPI/escalade/merges","archive_url":"https://api.github.com/repos/pluginsGLPI/escalade/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pluginsGLPI/escalade/downloads","issues_url":"https://api.github.com/repos/pluginsGLPI/escalade/issues{/number}","pulls_url":"https://api.github.com/repos/pluginsGLPI/escalade/pulls{/number}","milestones_url":"https://api.github.com/repos/pluginsGLPI/escalade/milestones{/number}","notifications_url":"https://api.github.com/repos/pluginsGLPI/escalade/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pluginsGLPI/escalade/labels{/name}","releases_url":"https://api.github.com/repos/pluginsGLPI/escalade/releases{/id}","deployments_url":"https://api.github.com/repos/pluginsGLPI/escalade/deployments","created_at":"2015-05-12T14:51:48Z","updated_at":"2018-09-04T14:15:50Z","pushed_at":"2018-09-18T13:06:18Z","git_url":"git://github.com/pluginsGLPI/escalade.git","ssh_url":"git@github.com:pluginsGLPI/escalade.git","clone_url":"https://github.com/pluginsGLPI/escalade.git","svn_url":"https://github.com/pluginsGLPI/escalade","homepage":"http://www.teclib-edition.com","size":360,"stargazers_count":6,"watchers_count":6,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":16,"open_issues":17,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/62"},"html":{"href":"https://github.com/pluginsGLPI/escalade/pull/62"},"issue":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/issues/62"},"comments":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/pluginsGLPI/escalade/statuses/dad2e20796caed5fd86be74323554eaf5414fed3"}},"author_association":"NONE"}}
{"actor":{"display_login":"Badoche1337"}}