{"action":"created","comment":{"url":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/comments/32843278","id":32843278,"diff_hunk":"@@ -0,0 +1,23 @@\n+class ServiceReport < ActiveRecord::Base\n+\n+  def self.report(id)\n+     survey_results = effectiveness_survey(id)\n+     {}.merge(survey_results)\n+  end\n+\n+  def self.effectiveness_survey(id)\n+    {:survey => {:positive =>\"#{overall_effectiveness(id)}\",\n+                 :negative => \"#{ 100 - overall_effectiveness(id)}\"},\n+     :title => ServiceSurvey.find(id).title\n+    }\n+  end\n+\n+  def self.overall_effectiveness(id)\n+    rating_answers(id).map(&:score).sum.to_i\n+  end\n+\n+  def self.rating_answers(id)\n+    ServiceSurvey.find(id).rating_answers\n+  end\n+\n+end","path":"app/models/service_report.rb","position":23,"original_position":23,"commit_id":"e390c43b9e6c1146a3aa206d5394997d4c225ee8","original_commit_id":"e390c43b9e6c1146a3aa206d5394997d4c225ee8","user":{"login":"abisosa","id":1024556,"avatar_url":"https://avatars.githubusercontent.com/u/1024556?v=3","gravatar_id":"","url":"https://api.github.com/users/abisosa","html_url":"https://github.com/abisosa","followers_url":"https://api.github.com/users/abisosa/followers","following_url":"https://api.github.com/users/abisosa/following{/other_user}","gists_url":"https://api.github.com/users/abisosa/gists{/gist_id}","starred_url":"https://api.github.com/users/abisosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abisosa/subscriptions","organizations_url":"https://api.github.com/users/abisosa/orgs","repos_url":"https://api.github.com/users/abisosa/repos","events_url":"https://api.github.com/users/abisosa/events{/privacy}","received_events_url":"https://api.github.com/users/abisosa/received_events","type":"User","site_admin":false},"body":"@poguez no estoy segura si es necesario un modelo si no se va a persistir en la base de datos. Quizás los reportes pueden estar en un módulo de servicios que se llame  ```ServiceReports```o algo similar y podamos mandarle ya sea la encuesta o los objetos que requiera.","created_at":"2015-06-19T16:07:29Z","updated_at":"2015-06-19T16:07:29Z","html_url":"https://github.com/civica-digital/urbem-puebla/pull/7#discussion_r32843278","pull_request_url":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/comments/32843278"},"html":{"href":"https://github.com/civica-digital/urbem-puebla/pull/7#discussion_r32843278"},"pull_request":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/7","id":38040251,"html_url":"https://github.com/civica-digital/urbem-puebla/pull/7","diff_url":"https://github.com/civica-digital/urbem-puebla/pull/7.diff","patch_url":"https://github.com/civica-digital/urbem-puebla/pull/7.patch","issue_url":"https://api.github.com/repos/civica-digital/urbem-puebla/issues/7","number":7,"state":"open","locked":false,"title":"Se crean reportes para encuestas.","user":{"login":"poguez","id":732015,"avatar_url":"https://avatars.githubusercontent.com/u/732015?v=3","gravatar_id":"","url":"https://api.github.com/users/poguez","html_url":"https://github.com/poguez","followers_url":"https://api.github.com/users/poguez/followers","following_url":"https://api.github.com/users/poguez/following{/other_user}","gists_url":"https://api.github.com/users/poguez/gists{/gist_id}","starred_url":"https://api.github.com/users/poguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poguez/subscriptions","organizations_url":"https://api.github.com/users/poguez/orgs","repos_url":"https://api.github.com/users/poguez/repos","events_url":"https://api.github.com/users/poguez/events{/privacy}","received_events_url":"https://api.github.com/users/poguez/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-18T18:56:08Z","updated_at":"2015-06-19T16:07:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33469b6829f494d174ad83b9c6874a9ed4940d42","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/7/commits","review_comments_url":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/7/comments","review_comment_url":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civica-digital/urbem-puebla/issues/7/comments","statuses_url":"https://api.github.com/repos/civica-digital/urbem-puebla/statuses/e390c43b9e6c1146a3aa206d5394997d4c225ee8","head":{"label":"civica-digital:service-reports","ref":"service-reports","sha":"e390c43b9e6c1146a3aa206d5394997d4c225ee8","user":{"login":"civica-digital","id":10727864,"avatar_url":"https://avatars.githubusercontent.com/u/10727864?v=3","gravatar_id":"","url":"https://api.github.com/users/civica-digital","html_url":"https://github.com/civica-digital","followers_url":"https://api.github.com/users/civica-digital/followers","following_url":"https://api.github.com/users/civica-digital/following{/other_user}","gists_url":"https://api.github.com/users/civica-digital/gists{/gist_id}","starred_url":"https://api.github.com/users/civica-digital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civica-digital/subscriptions","organizations_url":"https://api.github.com/users/civica-digital/orgs","repos_url":"https://api.github.com/users/civica-digital/repos","events_url":"https://api.github.com/users/civica-digital/events{/privacy}","received_events_url":"https://api.github.com/users/civica-digital/received_events","type":"Organization","site_admin":false},"repo":{"id":32949964,"name":"urbem-puebla","full_name":"civica-digital/urbem-puebla","owner":{"login":"civica-digital","id":10727864,"avatar_url":"https://avatars.githubusercontent.com/u/10727864?v=3","gravatar_id":"","url":"https://api.github.com/users/civica-digital","html_url":"https://github.com/civica-digital","followers_url":"https://api.github.com/users/civica-digital/followers","following_url":"https://api.github.com/users/civica-digital/following{/other_user}","gists_url":"https://api.github.com/users/civica-digital/gists{/gist_id}","starred_url":"https://api.github.com/users/civica-digital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civica-digital/subscriptions","organizations_url":"https://api.github.com/users/civica-digital/orgs","repos_url":"https://api.github.com/users/civica-digital/repos","events_url":"https://api.github.com/users/civica-digital/events{/privacy}","received_events_url":"https://api.github.com/users/civica-digital/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civica-digital/urbem-puebla","description":"La plataforma de código abierto para la gestión de reportes ciudadanos.","fork":true,"url":"https://api.github.com/repos/civica-digital/urbem-puebla","forks_url":"https://api.github.com/repos/civica-digital/urbem-puebla/forks","keys_url":"https://api.github.com/repos/civica-digital/urbem-puebla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civica-digital/urbem-puebla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civica-digital/urbem-puebla/teams","hooks_url":"https://api.github.com/repos/civica-digital/urbem-puebla/hooks","issue_events_url":"https://api.github.com/repos/civica-digital/urbem-puebla/issues/events{/number}","events_url":"https://api.github.com/repos/civica-digital/urbem-puebla/events","assignees_url":"https://api.github.com/repos/civica-digital/urbem-puebla/assignees{/user}","branches_url":"https://api.github.com/repos/civica-digital/urbem-puebla/branches{/branch}","tags_url":"https://api.github.com/repos/civica-digital/urbem-puebla/tags","blobs_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/refs{/sha}","trees_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civica-digital/urbem-puebla/statuses/{sha}","languages_url":"https://api.github.com/repos/civica-digital/urbem-puebla/languages","stargazers_url":"https://api.github.com/repos/civica-digital/urbem-puebla/stargazers","contributors_url":"https://api.github.com/repos/civica-digital/urbem-puebla/contributors","subscribers_url":"https://api.github.com/repos/civica-digital/urbem-puebla/subscribers","subscription_url":"https://api.github.com/repos/civica-digital/urbem-puebla/subscription","commits_url":"https://api.github.com/repos/civica-digital/urbem-puebla/commits{/sha}","git_commits_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/commits{/sha}","comments_url":"https://api.github.com/repos/civica-digital/urbem-puebla/comments{/number}","issue_comment_url":"https://api.github.com/repos/civica-digital/urbem-puebla/issues/comments{/number}","contents_url":"https://api.github.com/repos/civica-digital/urbem-puebla/contents/{+path}","compare_url":"https://api.github.com/repos/civica-digital/urbem-puebla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civica-digital/urbem-puebla/merges","archive_url":"https://api.github.com/repos/civica-digital/urbem-puebla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civica-digital/urbem-puebla/downloads","issues_url":"https://api.github.com/repos/civica-digital/urbem-puebla/issues{/number}","pulls_url":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls{/number}","milestones_url":"https://api.github.com/repos/civica-digital/urbem-puebla/milestones{/number}","notifications_url":"https://api.github.com/repos/civica-digital/urbem-puebla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civica-digital/urbem-puebla/labels{/name}","releases_url":"https://api.github.com/repos/civica-digital/urbem-puebla/releases{/id}","created_at":"2015-03-26T20:23:41Z","updated_at":"2015-03-26T20:24:04Z","pushed_at":"2015-06-18T18:56:08Z","git_url":"git://github.com/civica-digital/urbem-puebla.git","ssh_url":"git@github.com:civica-digital/urbem-puebla.git","clone_url":"https://github.com/civica-digital/urbem-puebla.git","svn_url":"https://github.com/civica-digital/urbem-puebla","homepage":"http://codeandomexico.github.io/reporte-ciudadano/","size":3188,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"civica-digital:service-surveys","ref":"service-surveys","sha":"e2f6ee82f96cf9d1281335b8a39d359d1be37cd4","user":{"login":"civica-digital","id":10727864,"avatar_url":"https://avatars.githubusercontent.com/u/10727864?v=3","gravatar_id":"","url":"https://api.github.com/users/civica-digital","html_url":"https://github.com/civica-digital","followers_url":"https://api.github.com/users/civica-digital/followers","following_url":"https://api.github.com/users/civica-digital/following{/other_user}","gists_url":"https://api.github.com/users/civica-digital/gists{/gist_id}","starred_url":"https://api.github.com/users/civica-digital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civica-digital/subscriptions","organizations_url":"https://api.github.com/users/civica-digital/orgs","repos_url":"https://api.github.com/users/civica-digital/repos","events_url":"https://api.github.com/users/civica-digital/events{/privacy}","received_events_url":"https://api.github.com/users/civica-digital/received_events","type":"Organization","site_admin":false},"repo":{"id":32949964,"name":"urbem-puebla","full_name":"civica-digital/urbem-puebla","owner":{"login":"civica-digital","id":10727864,"avatar_url":"https://avatars.githubusercontent.com/u/10727864?v=3","gravatar_id":"","url":"https://api.github.com/users/civica-digital","html_url":"https://github.com/civica-digital","followers_url":"https://api.github.com/users/civica-digital/followers","following_url":"https://api.github.com/users/civica-digital/following{/other_user}","gists_url":"https://api.github.com/users/civica-digital/gists{/gist_id}","starred_url":"https://api.github.com/users/civica-digital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civica-digital/subscriptions","organizations_url":"https://api.github.com/users/civica-digital/orgs","repos_url":"https://api.github.com/users/civica-digital/repos","events_url":"https://api.github.com/users/civica-digital/events{/privacy}","received_events_url":"https://api.github.com/users/civica-digital/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civica-digital/urbem-puebla","description":"La plataforma de código abierto para la gestión de reportes ciudadanos.","fork":true,"url":"https://api.github.com/repos/civica-digital/urbem-puebla","forks_url":"https://api.github.com/repos/civica-digital/urbem-puebla/forks","keys_url":"https://api.github.com/repos/civica-digital/urbem-puebla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civica-digital/urbem-puebla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civica-digital/urbem-puebla/teams","hooks_url":"https://api.github.com/repos/civica-digital/urbem-puebla/hooks","issue_events_url":"https://api.github.com/repos/civica-digital/urbem-puebla/issues/events{/number}","events_url":"https://api.github.com/repos/civica-digital/urbem-puebla/events","assignees_url":"https://api.github.com/repos/civica-digital/urbem-puebla/assignees{/user}","branches_url":"https://api.github.com/repos/civica-digital/urbem-puebla/branches{/branch}","tags_url":"https://api.github.com/repos/civica-digital/urbem-puebla/tags","blobs_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/refs{/sha}","trees_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civica-digital/urbem-puebla/statuses/{sha}","languages_url":"https://api.github.com/repos/civica-digital/urbem-puebla/languages","stargazers_url":"https://api.github.com/repos/civica-digital/urbem-puebla/stargazers","contributors_url":"https://api.github.com/repos/civica-digital/urbem-puebla/contributors","subscribers_url":"https://api.github.com/repos/civica-digital/urbem-puebla/subscribers","subscription_url":"https://api.github.com/repos/civica-digital/urbem-puebla/subscription","commits_url":"https://api.github.com/repos/civica-digital/urbem-puebla/commits{/sha}","git_commits_url":"https://api.github.com/repos/civica-digital/urbem-puebla/git/commits{/sha}","comments_url":"https://api.github.com/repos/civica-digital/urbem-puebla/comments{/number}","issue_comment_url":"https://api.github.com/repos/civica-digital/urbem-puebla/issues/comments{/number}","contents_url":"https://api.github.com/repos/civica-digital/urbem-puebla/contents/{+path}","compare_url":"https://api.github.com/repos/civica-digital/urbem-puebla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civica-digital/urbem-puebla/merges","archive_url":"https://api.github.com/repos/civica-digital/urbem-puebla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civica-digital/urbem-puebla/downloads","issues_url":"https://api.github.com/repos/civica-digital/urbem-puebla/issues{/number}","pulls_url":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls{/number}","milestones_url":"https://api.github.com/repos/civica-digital/urbem-puebla/milestones{/number}","notifications_url":"https://api.github.com/repos/civica-digital/urbem-puebla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civica-digital/urbem-puebla/labels{/name}","releases_url":"https://api.github.com/repos/civica-digital/urbem-puebla/releases{/id}","created_at":"2015-03-26T20:23:41Z","updated_at":"2015-03-26T20:24:04Z","pushed_at":"2015-06-18T18:56:08Z","git_url":"git://github.com/civica-digital/urbem-puebla.git","ssh_url":"git@github.com:civica-digital/urbem-puebla.git","clone_url":"https://github.com/civica-digital/urbem-puebla.git","svn_url":"https://github.com/civica-digital/urbem-puebla","homepage":"http://codeandomexico.github.io/reporte-ciudadano/","size":3188,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/7"},"html":{"href":"https://github.com/civica-digital/urbem-puebla/pull/7"},"issue":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/issues/7"},"comments":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/civica-digital/urbem-puebla/statuses/e390c43b9e6c1146a3aa206d5394997d4c225ee8"}}}}