{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/wsm_02/pulls/comments/92350216","pull_request_review_id":12862507,"id":92350216,"diff_hunk":"@@ -3,26 +3,61 @@ class WorkspaceService\n \n   def initialize workspace\n     @workspace = workspace\n-    @result_msg = Array.new\n+    @result_msg = []\n     @updated_counter = 0\n   end\n \n   def build_sections node_data\n-    node_data.each do |index, object|\n+    flag = false\n+    temp_section = []\n+    section_delete = []\n+    section_workspaces = @workspace.sections\n+    node_data.each do |_index, object|\n       if object[\"isGroup\"]\n-        section = @workspace.sections.create section_params(object)\n-        if section.save\n-          @updated_counter += 1\n+        if section_workspaces.empty?\n+          section = @workspace.sections.create section_params(object)\n+          if section.save\n+            @updated_counter += 1\n+          else\n+            @result_msg.push I18n.t(\"dashboard.workspaces.update.error_at\",\n+              key: object[\"key\"])\n+          end\n         else\n-          @result_msg.push I18n.t(\"dashboard.workspaces.update.error_at\",\n-            key: object[\"key\"])\n+          section_workspaces.each do |section_workspace|\n+            if section_workspace.section_key == object[\"key\"]\n+              flag = false\n+              temp_section.push section_workspace\n+              section_delete = section_workspaces - temp_section\n+              if section_workspace.update section_params(object)\n+                @updated_counter += 1\n+              else\n+                @result_msg.push I18n.t(\"dashboard.workspaces.update.error_at\",\n+                  key: object[\"key\"])\n+              end\n+              break\n+            else\n+              flag = true\n+            end\n+          end\n+          if flag\n+            section = @workspace.sections.create section_params(object)\n+            if section.save\n+              @updated_counter += 1\n+            else\n+              @result_msg.push I18n.t(\"dashboard.workspaces.update.error_at\",\n+                key: object[\"key\"])","path":"app/services/workspace_service.rb","position":53,"original_position":53,"commit_id":"048feef6d7ff03e9cde2f4e6e7bbc21af709e225","original_commit_id":"048feef6d7ff03e9cde2f4e6e7bbc21af709e225","user":{"login":"framgia-jenkins-ci","id":16641396,"avatar_url":"https://avatars.githubusercontent.com/u/16641396?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia-jenkins-ci","html_url":"https://github.com/framgia-jenkins-ci","followers_url":"https://api.github.com/users/framgia-jenkins-ci/followers","following_url":"https://api.github.com/users/framgia-jenkins-ci/following{/other_user}","gists_url":"https://api.github.com/users/framgia-jenkins-ci/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia-jenkins-ci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia-jenkins-ci/subscriptions","organizations_url":"https://api.github.com/users/framgia-jenkins-ci/orgs","repos_url":"https://api.github.com/users/framgia-jenkins-ci/repos","events_url":"https://api.github.com/users/framgia-jenkins-ci/events{/privacy}","received_events_url":"https://api.github.com/users/framgia-jenkins-ci/received_events","type":"User","site_admin":false},"body":"**Reporter**: CHECKSTYLE\n**Rule**: com.puppycrawl.tools.checkstyle.Style/StringLiterals\n**Severity**: INFO\n**File**: app/services/workspace_service.rb L48\n\nPrefer single-quoted strings when you don&apos;t need string interpolation or special symbols.\n\n*<this is a auto generated comment from violation-comments-lib F7F8ASD8123FSDF>*\n","created_at":"2016-12-14T09:23:47Z","updated_at":"2016-12-14T09:23:47Z","html_url":"https://github.com/framgia/wsm_02/pull/26#discussion_r92350216","pull_request_url":"https://api.github.com/repos/framgia/wsm_02/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/framgia/wsm_02/pulls/comments/92350216"},"html":{"href":"https://github.com/framgia/wsm_02/pull/26#discussion_r92350216"},"pull_request":{"href":"https://api.github.com/repos/framgia/wsm_02/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/wsm_02/pulls/26","id":97904947,"html_url":"https://github.com/framgia/wsm_02/pull/26","diff_url":"https://github.com/framgia/wsm_02/pull/26.diff","patch_url":"https://github.com/framgia/wsm_02/pull/26.patch","issue_url":"https://api.github.com/repos/framgia/wsm_02/issues/26","number":26,"state":"open","locked":false,"title":"update and delete section gojs","user":{"login":"NguyenHuuGiap","id":22047045,"avatar_url":"https://avatars.githubusercontent.com/u/22047045?v=3","gravatar_id":"","url":"https://api.github.com/users/NguyenHuuGiap","html_url":"https://github.com/NguyenHuuGiap","followers_url":"https://api.github.com/users/NguyenHuuGiap/followers","following_url":"https://api.github.com/users/NguyenHuuGiap/following{/other_user}","gists_url":"https://api.github.com/users/NguyenHuuGiap/gists{/gist_id}","starred_url":"https://api.github.com/users/NguyenHuuGiap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NguyenHuuGiap/subscriptions","organizations_url":"https://api.github.com/users/NguyenHuuGiap/orgs","repos_url":"https://api.github.com/users/NguyenHuuGiap/repos","events_url":"https://api.github.com/users/NguyenHuuGiap/events{/privacy}","received_events_url":"https://api.github.com/users/NguyenHuuGiap/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-14T08:10:02Z","updated_at":"2016-12-14T09:23:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9af466854400b63defaeaa1f1e5a45c40fe5256b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/wsm_02/pulls/26/commits","review_comments_url":"https://api.github.com/repos/framgia/wsm_02/pulls/26/comments","review_comment_url":"https://api.github.com/repos/framgia/wsm_02/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/wsm_02/issues/26/comments","statuses_url":"https://api.github.com/repos/framgia/wsm_02/statuses/048feef6d7ff03e9cde2f4e6e7bbc21af709e225","head":{"label":"NguyenHuuGiap:update_delete_section_gojs","ref":"update_delete_section_gojs","sha":"048feef6d7ff03e9cde2f4e6e7bbc21af709e225","user":{"login":"NguyenHuuGiap","id":22047045,"avatar_url":"https://avatars.githubusercontent.com/u/22047045?v=3","gravatar_id":"","url":"https://api.github.com/users/NguyenHuuGiap","html_url":"https://github.com/NguyenHuuGiap","followers_url":"https://api.github.com/users/NguyenHuuGiap/followers","following_url":"https://api.github.com/users/NguyenHuuGiap/following{/other_user}","gists_url":"https://api.github.com/users/NguyenHuuGiap/gists{/gist_id}","starred_url":"https://api.github.com/users/NguyenHuuGiap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NguyenHuuGiap/subscriptions","organizations_url":"https://api.github.com/users/NguyenHuuGiap/orgs","repos_url":"https://api.github.com/users/NguyenHuuGiap/repos","events_url":"https://api.github.com/users/NguyenHuuGiap/events{/privacy}","received_events_url":"https://api.github.com/users/NguyenHuuGiap/received_events","type":"User","site_admin":false},"repo":{"id":75050186,"name":"wsm_02","full_name":"NguyenHuuGiap/wsm_02","owner":{"login":"NguyenHuuGiap","id":22047045,"avatar_url":"https://avatars.githubusercontent.com/u/22047045?v=3","gravatar_id":"","url":"https://api.github.com/users/NguyenHuuGiap","html_url":"https://github.com/NguyenHuuGiap","followers_url":"https://api.github.com/users/NguyenHuuGiap/followers","following_url":"https://api.github.com/users/NguyenHuuGiap/following{/other_user}","gists_url":"https://api.github.com/users/NguyenHuuGiap/gists{/gist_id}","starred_url":"https://api.github.com/users/NguyenHuuGiap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NguyenHuuGiap/subscriptions","organizations_url":"https://api.github.com/users/NguyenHuuGiap/orgs","repos_url":"https://api.github.com/users/NguyenHuuGiap/repos","events_url":"https://api.github.com/users/NguyenHuuGiap/events{/privacy}","received_events_url":"https://api.github.com/users/NguyenHuuGiap/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NguyenHuuGiap/wsm_02","description":null,"fork":true,"url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02","forks_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/forks","keys_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/teams","hooks_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/hooks","issue_events_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/issues/events{/number}","events_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/events","assignees_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/assignees{/user}","branches_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/branches{/branch}","tags_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/tags","blobs_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/git/refs{/sha}","trees_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/statuses/{sha}","languages_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/languages","stargazers_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/stargazers","contributors_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/contributors","subscribers_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/subscribers","subscription_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/subscription","commits_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/commits{/sha}","git_commits_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/git/commits{/sha}","comments_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/comments{/number}","issue_comment_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/issues/comments{/number}","contents_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/contents/{+path}","compare_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/merges","archive_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/downloads","issues_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/issues{/number}","pulls_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/pulls{/number}","milestones_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/milestones{/number}","notifications_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/labels{/name}","releases_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/releases{/id}","deployments_url":"https://api.github.com/repos/NguyenHuuGiap/wsm_02/deployments","created_at":"2016-11-29T06:22:25Z","updated_at":"2016-11-29T06:22:26Z","pushed_at":"2016-12-14T09:16:42Z","git_url":"git://github.com/NguyenHuuGiap/wsm_02.git","ssh_url":"git@github.com:NguyenHuuGiap/wsm_02.git","clone_url":"https://github.com/NguyenHuuGiap/wsm_02.git","svn_url":"https://github.com/NguyenHuuGiap/wsm_02","homepage":null,"size":1795,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"develop"}},"base":{"label":"framgia:master","ref":"master","sha":"4b579301e4461490ab9db5c40228511e72f0eeae","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":74431382,"name":"wsm_02","full_name":"framgia/wsm_02","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/wsm_02","description":null,"fork":false,"url":"https://api.github.com/repos/framgia/wsm_02","forks_url":"https://api.github.com/repos/framgia/wsm_02/forks","keys_url":"https://api.github.com/repos/framgia/wsm_02/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/wsm_02/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/wsm_02/teams","hooks_url":"https://api.github.com/repos/framgia/wsm_02/hooks","issue_events_url":"https://api.github.com/repos/framgia/wsm_02/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/wsm_02/events","assignees_url":"https://api.github.com/repos/framgia/wsm_02/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/wsm_02/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/wsm_02/tags","blobs_url":"https://api.github.com/repos/framgia/wsm_02/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/wsm_02/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/wsm_02/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/wsm_02/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/wsm_02/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/wsm_02/languages","stargazers_url":"https://api.github.com/repos/framgia/wsm_02/stargazers","contributors_url":"https://api.github.com/repos/framgia/wsm_02/contributors","subscribers_url":"https://api.github.com/repos/framgia/wsm_02/subscribers","subscription_url":"https://api.github.com/repos/framgia/wsm_02/subscription","commits_url":"https://api.github.com/repos/framgia/wsm_02/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/wsm_02/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/wsm_02/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/wsm_02/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/wsm_02/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/wsm_02/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/wsm_02/merges","archive_url":"https://api.github.com/repos/framgia/wsm_02/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/wsm_02/downloads","issues_url":"https://api.github.com/repos/framgia/wsm_02/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/wsm_02/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/wsm_02/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/wsm_02/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/wsm_02/labels{/name}","releases_url":"https://api.github.com/repos/framgia/wsm_02/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/wsm_02/deployments","created_at":"2016-11-22T03:40:58Z","updated_at":"2016-12-08T06:11:06Z","pushed_at":"2016-12-14T09:16:42Z","git_url":"git://github.com/framgia/wsm_02.git","ssh_url":"git@github.com:framgia/wsm_02.git","clone_url":"https://github.com/framgia/wsm_02.git","svn_url":"https://github.com/framgia/wsm_02","homepage":null,"size":1795,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":4,"forks":11,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/wsm_02/pulls/26"},"html":{"href":"https://github.com/framgia/wsm_02/pull/26"},"issue":{"href":"https://api.github.com/repos/framgia/wsm_02/issues/26"},"comments":{"href":"https://api.github.com/repos/framgia/wsm_02/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/wsm_02/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/wsm_02/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/wsm_02/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/wsm_02/statuses/048feef6d7ff03e9cde2f4e6e7bbc21af709e225"}}}}
{"actor":{"display_login":"framgia-jenkins-ci"}}