{"action":"created","comment":{"url":"https://api.github.com/repos/sgmap/tps/pulls/comments/112005543","pull_request_review_id":33287553,"id":112005543,"diff_hunk":"@@ -1,25 +1,21 @@\n class PiecesJustificativesService\n-  def self.upload! dossier, user, params\n-    errors = ''\n-\n-    dossier.types_de_piece_justificative.each do |type_de_pieces_justificatives|\n-      unless params[\"piece_justificative_#{type_de_pieces_justificatives.id}\"].nil?\n-\n-        if ClamavService.safe_file? params[\"piece_justificative_#{type_de_pieces_justificatives.id}\"].path\n-          piece_justificative = PieceJustificative.new(content: params[\"piece_justificative_#{type_de_pieces_justificatives.id}\"],\n-                                                       dossier: dossier,\n-                                                       type_de_piece_justificative: type_de_pieces_justificatives,\n-                                                       user: user)\n-\n-          unless piece_justificative.save\n-            errors << piece_justificative.errors.messages[:content][0]+\" (#{piece_justificative.libelle})\"+\"<br>\"\n-          end\n-        else\n-          errors << params[\"piece_justificative_#{type_de_pieces_justificatives.id}\"].original_filename+\": <b>Virus détecté !!</b>\"+\"<br>\"\n-        end\n-      end\n-    end\n-    errors\n+  def self.upload!(dossier, user, params)\n+    tpj_contents = dossier.types_de_piece_justificative\n+                          .map { |tpj| [tpj, params[\"piece_justificative_#{tpj.id}\"]] }\n+                          .select { |_, content| content }","path":"app/services/pieces_justificatives_service.rb","position":26,"original_position":26,"commit_id":"367b7c6ae169fe80224d65dd0c1544bf889023ff","original_commit_id":"c7cb459c3e6510a0574e0be3cb87a779631ded76","user":{"login":"gregoirenovel","id":1333173,"avatar_url":"https://avatars1.githubusercontent.com/u/1333173?v=3","gravatar_id":"","url":"https://api.github.com/users/gregoirenovel","html_url":"https://github.com/gregoirenovel","followers_url":"https://api.github.com/users/gregoirenovel/followers","following_url":"https://api.github.com/users/gregoirenovel/following{/other_user}","gists_url":"https://api.github.com/users/gregoirenovel/gists{/gist_id}","starred_url":"https://api.github.com/users/gregoirenovel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregoirenovel/subscriptions","organizations_url":"https://api.github.com/users/gregoirenovel/orgs","repos_url":"https://api.github.com/users/gregoirenovel/repos","events_url":"https://api.github.com/users/gregoirenovel/events{/privacy}","received_events_url":"https://api.github.com/users/gregoirenovel/received_events","type":"User","site_admin":false},"body":"?\r\n","created_at":"2017-04-18T16:48:13Z","updated_at":"2017-04-18T16:48:13Z","html_url":"https://github.com/sgmap/tps/pull/82#discussion_r112005543","pull_request_url":"https://api.github.com/repos/sgmap/tps/pulls/82","_links":{"self":{"href":"https://api.github.com/repos/sgmap/tps/pulls/comments/112005543"},"html":{"href":"https://github.com/sgmap/tps/pull/82#discussion_r112005543"},"pull_request":{"href":"https://api.github.com/repos/sgmap/tps/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/sgmap/tps/pulls/82","id":115306553,"html_url":"https://github.com/sgmap/tps/pull/82","diff_url":"https://github.com/sgmap/tps/pull/82.diff","patch_url":"https://github.com/sgmap/tps/pull/82.patch","issue_url":"https://api.github.com/repos/sgmap/tps/issues/82","number":82,"state":"closed","locked":false,"title":"Pieces justificatives refactor","user":{"login":"LeSim","id":907405,"avatar_url":"https://avatars0.githubusercontent.com/u/907405?v=3","gravatar_id":"","url":"https://api.github.com/users/LeSim","html_url":"https://github.com/LeSim","followers_url":"https://api.github.com/users/LeSim/followers","following_url":"https://api.github.com/users/LeSim/following{/other_user}","gists_url":"https://api.github.com/users/LeSim/gists{/gist_id}","starred_url":"https://api.github.com/users/LeSim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeSim/subscriptions","organizations_url":"https://api.github.com/users/LeSim/orgs","repos_url":"https://api.github.com/users/LeSim/repos","events_url":"https://api.github.com/users/LeSim/events{/privacy}","received_events_url":"https://api.github.com/users/LeSim/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-04-11T12:18:36Z","updated_at":"2017-04-18T16:48:13Z","closed_at":"2017-04-18T16:07:12Z","merged_at":"2017-04-18T16:07:12Z","merge_commit_sha":"030bdc86d688124f479765f54d22ec042bcf71f4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sgmap/tps/pulls/82/commits","review_comments_url":"https://api.github.com/repos/sgmap/tps/pulls/82/comments","review_comment_url":"https://api.github.com/repos/sgmap/tps/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sgmap/tps/issues/82/comments","statuses_url":"https://api.github.com/repos/sgmap/tps/statuses/367b7c6ae169fe80224d65dd0c1544bf889023ff","head":{"label":"sgmap:pieces_justificatives_refactor","ref":"pieces_justificatives_refactor","sha":"367b7c6ae169fe80224d65dd0c1544bf889023ff","user":{"login":"sgmap","id":7874148,"avatar_url":"https://avatars3.githubusercontent.com/u/7874148?v=3","gravatar_id":"","url":"https://api.github.com/users/sgmap","html_url":"https://github.com/sgmap","followers_url":"https://api.github.com/users/sgmap/followers","following_url":"https://api.github.com/users/sgmap/following{/other_user}","gists_url":"https://api.github.com/users/sgmap/gists{/gist_id}","starred_url":"https://api.github.com/users/sgmap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgmap/subscriptions","organizations_url":"https://api.github.com/users/sgmap/orgs","repos_url":"https://api.github.com/users/sgmap/repos","events_url":"https://api.github.com/users/sgmap/events{/privacy}","received_events_url":"https://api.github.com/users/sgmap/received_events","type":"Organization","site_admin":false},"repo":{"id":44167674,"name":"tps","full_name":"sgmap/tps","owner":{"login":"sgmap","id":7874148,"avatar_url":"https://avatars3.githubusercontent.com/u/7874148?v=3","gravatar_id":"","url":"https://api.github.com/users/sgmap","html_url":"https://github.com/sgmap","followers_url":"https://api.github.com/users/sgmap/followers","following_url":"https://api.github.com/users/sgmap/following{/other_user}","gists_url":"https://api.github.com/users/sgmap/gists{/gist_id}","starred_url":"https://api.github.com/users/sgmap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgmap/subscriptions","organizations_url":"https://api.github.com/users/sgmap/orgs","repos_url":"https://api.github.com/users/sgmap/repos","events_url":"https://api.github.com/users/sgmap/events{/privacy}","received_events_url":"https://api.github.com/users/sgmap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sgmap/tps","description":"TéléProcédures administratives Simplifiées","fork":false,"url":"https://api.github.com/repos/sgmap/tps","forks_url":"https://api.github.com/repos/sgmap/tps/forks","keys_url":"https://api.github.com/repos/sgmap/tps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sgmap/tps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sgmap/tps/teams","hooks_url":"https://api.github.com/repos/sgmap/tps/hooks","issue_events_url":"https://api.github.com/repos/sgmap/tps/issues/events{/number}","events_url":"https://api.github.com/repos/sgmap/tps/events","assignees_url":"https://api.github.com/repos/sgmap/tps/assignees{/user}","branches_url":"https://api.github.com/repos/sgmap/tps/branches{/branch}","tags_url":"https://api.github.com/repos/sgmap/tps/tags","blobs_url":"https://api.github.com/repos/sgmap/tps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sgmap/tps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sgmap/tps/git/refs{/sha}","trees_url":"https://api.github.com/repos/sgmap/tps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sgmap/tps/statuses/{sha}","languages_url":"https://api.github.com/repos/sgmap/tps/languages","stargazers_url":"https://api.github.com/repos/sgmap/tps/stargazers","contributors_url":"https://api.github.com/repos/sgmap/tps/contributors","subscribers_url":"https://api.github.com/repos/sgmap/tps/subscribers","subscription_url":"https://api.github.com/repos/sgmap/tps/subscription","commits_url":"https://api.github.com/repos/sgmap/tps/commits{/sha}","git_commits_url":"https://api.github.com/repos/sgmap/tps/git/commits{/sha}","comments_url":"https://api.github.com/repos/sgmap/tps/comments{/number}","issue_comment_url":"https://api.github.com/repos/sgmap/tps/issues/comments{/number}","contents_url":"https://api.github.com/repos/sgmap/tps/contents/{+path}","compare_url":"https://api.github.com/repos/sgmap/tps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sgmap/tps/merges","archive_url":"https://api.github.com/repos/sgmap/tps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sgmap/tps/downloads","issues_url":"https://api.github.com/repos/sgmap/tps/issues{/number}","pulls_url":"https://api.github.com/repos/sgmap/tps/pulls{/number}","milestones_url":"https://api.github.com/repos/sgmap/tps/milestones{/number}","notifications_url":"https://api.github.com/repos/sgmap/tps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sgmap/tps/labels{/name}","releases_url":"https://api.github.com/repos/sgmap/tps/releases{/id}","deployments_url":"https://api.github.com/repos/sgmap/tps/deployments","created_at":"2015-10-13T10:01:34Z","updated_at":"2017-04-07T12:14:46Z","pushed_at":"2017-04-18T16:10:18Z","git_url":"git://github.com/sgmap/tps.git","ssh_url":"git@github.com:sgmap/tps.git","clone_url":"https://github.com/sgmap/tps.git","svn_url":"https://github.com/sgmap/tps","homepage":"https://tps.apientreprise.fr","size":13930,"stargazers_count":8,"watchers_count":8,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":25,"forks":4,"open_issues":25,"watchers":8,"default_branch":"develop"}},"base":{"label":"sgmap:develop","ref":"develop","sha":"955552b0d2c39e091f92693e6e82400e90cc010d","user":{"login":"sgmap","id":7874148,"avatar_url":"https://avatars3.githubusercontent.com/u/7874148?v=3","gravatar_id":"","url":"https://api.github.com/users/sgmap","html_url":"https://github.com/sgmap","followers_url":"https://api.github.com/users/sgmap/followers","following_url":"https://api.github.com/users/sgmap/following{/other_user}","gists_url":"https://api.github.com/users/sgmap/gists{/gist_id}","starred_url":"https://api.github.com/users/sgmap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgmap/subscriptions","organizations_url":"https://api.github.com/users/sgmap/orgs","repos_url":"https://api.github.com/users/sgmap/repos","events_url":"https://api.github.com/users/sgmap/events{/privacy}","received_events_url":"https://api.github.com/users/sgmap/received_events","type":"Organization","site_admin":false},"repo":{"id":44167674,"name":"tps","full_name":"sgmap/tps","owner":{"login":"sgmap","id":7874148,"avatar_url":"https://avatars3.githubusercontent.com/u/7874148?v=3","gravatar_id":"","url":"https://api.github.com/users/sgmap","html_url":"https://github.com/sgmap","followers_url":"https://api.github.com/users/sgmap/followers","following_url":"https://api.github.com/users/sgmap/following{/other_user}","gists_url":"https://api.github.com/users/sgmap/gists{/gist_id}","starred_url":"https://api.github.com/users/sgmap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgmap/subscriptions","organizations_url":"https://api.github.com/users/sgmap/orgs","repos_url":"https://api.github.com/users/sgmap/repos","events_url":"https://api.github.com/users/sgmap/events{/privacy}","received_events_url":"https://api.github.com/users/sgmap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sgmap/tps","description":"TéléProcédures administratives Simplifiées","fork":false,"url":"https://api.github.com/repos/sgmap/tps","forks_url":"https://api.github.com/repos/sgmap/tps/forks","keys_url":"https://api.github.com/repos/sgmap/tps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sgmap/tps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sgmap/tps/teams","hooks_url":"https://api.github.com/repos/sgmap/tps/hooks","issue_events_url":"https://api.github.com/repos/sgmap/tps/issues/events{/number}","events_url":"https://api.github.com/repos/sgmap/tps/events","assignees_url":"https://api.github.com/repos/sgmap/tps/assignees{/user}","branches_url":"https://api.github.com/repos/sgmap/tps/branches{/branch}","tags_url":"https://api.github.com/repos/sgmap/tps/tags","blobs_url":"https://api.github.com/repos/sgmap/tps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sgmap/tps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sgmap/tps/git/refs{/sha}","trees_url":"https://api.github.com/repos/sgmap/tps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sgmap/tps/statuses/{sha}","languages_url":"https://api.github.com/repos/sgmap/tps/languages","stargazers_url":"https://api.github.com/repos/sgmap/tps/stargazers","contributors_url":"https://api.github.com/repos/sgmap/tps/contributors","subscribers_url":"https://api.github.com/repos/sgmap/tps/subscribers","subscription_url":"https://api.github.com/repos/sgmap/tps/subscription","commits_url":"https://api.github.com/repos/sgmap/tps/commits{/sha}","git_commits_url":"https://api.github.com/repos/sgmap/tps/git/commits{/sha}","comments_url":"https://api.github.com/repos/sgmap/tps/comments{/number}","issue_comment_url":"https://api.github.com/repos/sgmap/tps/issues/comments{/number}","contents_url":"https://api.github.com/repos/sgmap/tps/contents/{+path}","compare_url":"https://api.github.com/repos/sgmap/tps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sgmap/tps/merges","archive_url":"https://api.github.com/repos/sgmap/tps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sgmap/tps/downloads","issues_url":"https://api.github.com/repos/sgmap/tps/issues{/number}","pulls_url":"https://api.github.com/repos/sgmap/tps/pulls{/number}","milestones_url":"https://api.github.com/repos/sgmap/tps/milestones{/number}","notifications_url":"https://api.github.com/repos/sgmap/tps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sgmap/tps/labels{/name}","releases_url":"https://api.github.com/repos/sgmap/tps/releases{/id}","deployments_url":"https://api.github.com/repos/sgmap/tps/deployments","created_at":"2015-10-13T10:01:34Z","updated_at":"2017-04-07T12:14:46Z","pushed_at":"2017-04-18T16:10:18Z","git_url":"git://github.com/sgmap/tps.git","ssh_url":"git@github.com:sgmap/tps.git","clone_url":"https://github.com/sgmap/tps.git","svn_url":"https://github.com/sgmap/tps","homepage":"https://tps.apientreprise.fr","size":13930,"stargazers_count":8,"watchers_count":8,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":25,"forks":4,"open_issues":25,"watchers":8,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/sgmap/tps/pulls/82"},"html":{"href":"https://github.com/sgmap/tps/pull/82"},"issue":{"href":"https://api.github.com/repos/sgmap/tps/issues/82"},"comments":{"href":"https://api.github.com/repos/sgmap/tps/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/sgmap/tps/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/sgmap/tps/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sgmap/tps/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/sgmap/tps/statuses/367b7c6ae169fe80224d65dd0c1544bf889023ff"}}}}
{"actor":{"display_login":"gregoirenovel"}}