{"action":"created","comment":{"url":"https://api.github.com/repos/pauloborba/RPA/pulls/comments/87108443","pull_request_review_id":7733892,"id":87108443,"diff_hunk":"@@ -0,0 +1,156 @@\n+package rpa\n+\n+\n+\n+import static org.springframework.http.HttpStatus.*\n+import grails.transaction.Transactional\n+\n+@Transactional(readOnly = true)\n+class ResearcherScoreController {\n+\n+    static allowedMethods = [save: \"POST\", update: \"PUT\", delete: \"DELETE\"]\n+\n+    def index(Integer max) {\n+        params.max = Math.min(max ?: 10, 100)\n+        respond ResearcherScore.list(params), model:[researcherScoreInstanceCount: ResearcherScore.count()]\n+    }\n+\n+    def show(ResearcherScore researcherScoreInstance) {\n+        respond researcherScoreInstance\n+    }\n+\n+    def create() {\n+        respond new ResearcherScore(params)\n+    }\n+\n+    @Transactional\n+    def save(ResearcherScore researcherScoreInstance) {\n+        if (researcherScoreInstance == null) {\n+            notFound()\n+            return\n+        }\n+\n+        if (researcherScoreInstance.hasErrors()) {\n+            respond researcherScoreInstance.errors, view:'create'\n+            return\n+        }\n+\n+        researcherScoreInstance.save flush:true\n+\n+        request.withFormat {\n+            form multipartForm {\n+                flash.message = message(code: 'default.created.message', args: [message(code: 'researcherScore.label', default: 'ResearcherScore'), researcherScoreInstance.id])\n+                redirect researcherScoreInstance\n+                researcherScoreInstance.score = CalculateScore(researcherScoreInstance);\n+                researcherScoreInstance.articlesNotFound = NotAvaliated(researcherScoreInstance.researcher.articles, researcherScoreInstance.qualis.avaliations)\n+            }\n+            '*' { respond researcherScoreInstance, [status: CREATED] }\n+\n+        }\n+    }\n+\n+    def edit(ResearcherScore researcherScoreInstance) {\n+        respond researcherScoreInstance\n+    }\n+\n+    @Transactional\n+    def update(ResearcherScore researcherScoreInstance) {\n+        if (researcherScoreInstance == null) {\n+            notFound()\n+            return\n+        }\n+\n+        if (researcherScoreInstance.hasErrors()) {\n+            respond researcherScoreInstance.errors, view:'edit'\n+            return\n+        }\n+\n+\n+        researcherScoreInstance.save flush:true\n+\n+        request.withFormat {\n+            form multipartForm {\n+                flash.message = message(code: 'default.updated.message', args: [message(code: 'ResearcherScore.label', default: 'ResearcherScore'), researcherScoreInstance.id])\n+                redirect researcherScoreInstance\n+                researcherScoreInstance.score = CalculateScore(researcherScoreInstance)\n+                researcherScoreInstance.articlesNotFound = NotAvaliated(researcherScoreInstance.researcher.articles, researcherScoreInstance.qualis.avaliations)\n+            }\n+            '*'{ respond researcherScoreInstance, [status: OK] }\n+        }\n+    }\n+\n+    @Transactional\n+    def delete(ResearcherScore researcherScoreInstance) {\n+\n+        if (researcherScoreInstance == null) {\n+            notFound()\n+            return\n+        }\n+\n+        researcherScoreInstance.delete flush:true\n+\n+        request.withFormat {\n+            form multipartForm {\n+                flash.message = message(code: 'default.deleted.message', args: [message(code: 'ResearcherScore.label', default: 'ResearcherScore'), researcherScoreInstance.id])\n+                redirect action:\"index\", method:\"GET\"\n+            }\n+            '*'{ render status: NO_CONTENT }\n+        }\n+    }\n+\n+    protected void notFound() {\n+        request.withFormat {\n+            form multipartForm {\n+                flash.message = message(code: 'default.not.found.message', args: [message(code: 'researcherScore.label', default: 'ResearcherScore'), params.id])\n+                redirect action: \"index\", method: \"GET\"\n+            }\n+            '*'{ render status: NOT_FOUND }\n+        }\n+    }\n+\n+    /*\n+    *   Receives a ReseacherScore from the .gsp view containing a Reseacher and a Qualis\n+    *   and scanf throught every Article in the Researcher, counting the score their journal\n+    *   has in the Qualis. Returns a String for the view to show the final score.\n+    */\n+    String CalculateScore(ResearcherScore researcherScoreInstance){\n+        Set<Article> researcherArticles = researcherScoreInstance.researcher.articles;\n+        Set<QualisAvaliation> qualisAvaliations =  researcherScoreInstance.qualis.avaliations;","path":"grails-app/controllers/rpa/ResearcherScoreController.groovy","position":118,"original_position":118,"commit_id":"6313c48c7a5acc065bb4d3aef1f6ab797d60825d","original_commit_id":"6313c48c7a5acc065bb4d3aef1f6ab797d60825d","user":{"login":"dgmneto","id":1363419,"avatar_url":"https://avatars.githubusercontent.com/u/1363419?v=3","gravatar_id":"","url":"https://api.github.com/users/dgmneto","html_url":"https://github.com/dgmneto","followers_url":"https://api.github.com/users/dgmneto/followers","following_url":"https://api.github.com/users/dgmneto/following{/other_user}","gists_url":"https://api.github.com/users/dgmneto/gists{/gist_id}","starred_url":"https://api.github.com/users/dgmneto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgmneto/subscriptions","organizations_url":"https://api.github.com/users/dgmneto/orgs","repos_url":"https://api.github.com/users/dgmneto/repos","events_url":"https://api.github.com/users/dgmneto/events{/privacy}","received_events_url":"https://api.github.com/users/dgmneto/received_events","type":"User","site_admin":false},"body":"Essas dua última linhas tem uma depêndencia de uma classe além da classe vizinha.","created_at":"2016-11-08T23:34:51Z","updated_at":"2016-11-08T23:34:51Z","html_url":"https://github.com/pauloborba/RPA/pull/3#discussion_r87108443","pull_request_url":"https://api.github.com/repos/pauloborba/RPA/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/pauloborba/RPA/pulls/comments/87108443"},"html":{"href":"https://github.com/pauloborba/RPA/pull/3#discussion_r87108443"},"pull_request":{"href":"https://api.github.com/repos/pauloborba/RPA/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/pauloborba/RPA/pulls/3","id":92511191,"html_url":"https://github.com/pauloborba/RPA/pull/3","diff_url":"https://github.com/pauloborba/RPA/pull/3.diff","patch_url":"https://github.com/pauloborba/RPA/pull/3.patch","issue_url":"https://api.github.com/repos/pauloborba/RPA/issues/3","number":3,"state":"open","locked":false,"title":"Journal of a Researcher not found in a Qualis feature implementation and tests","user":{"login":"Trakton","id":13110902,"avatar_url":"https://avatars.githubusercontent.com/u/13110902?v=3","gravatar_id":"","url":"https://api.github.com/users/Trakton","html_url":"https://github.com/Trakton","followers_url":"https://api.github.com/users/Trakton/followers","following_url":"https://api.github.com/users/Trakton/following{/other_user}","gists_url":"https://api.github.com/users/Trakton/gists{/gist_id}","starred_url":"https://api.github.com/users/Trakton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trakton/subscriptions","organizations_url":"https://api.github.com/users/Trakton/orgs","repos_url":"https://api.github.com/users/Trakton/repos","events_url":"https://api.github.com/users/Trakton/events{/privacy}","received_events_url":"https://api.github.com/users/Trakton/received_events","type":"User","site_admin":false},"body":"In order to see the workflow of the feature, run the GUI tests, or manually do:\r\n\r\n1. Populate the database with some stub articles\r\n2. Create a researcher having many of the created articles\r\n3. Create one qualis avaliation for each different article journal you've set\r\n4. Create a qualis having almost every qualis avaliation you've created, but leave some of them missing\r\n5. Create a researcher score using the researcher and qualis previously created\r\n\r\nThen, the researcher will be classified according to the qualis avaliations for each journal he has an article in. But for each qualis avaliation you've left missing, the qualis will have no way to score the researcher article based on it's journal. It will them count as a \"not avaliated\" article, and every not avaliated article will be shown in a list.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/pauloborba/rpa/3)\n<!-- Reviewable:end -->\n","created_at":"2016-11-07T01:03:55Z","updated_at":"2016-11-08T23:34:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ac7d553d8a24f555a3e3abb1f27ea33078f1d14","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pauloborba/RPA/pulls/3/commits","review_comments_url":"https://api.github.com/repos/pauloborba/RPA/pulls/3/comments","review_comment_url":"https://api.github.com/repos/pauloborba/RPA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pauloborba/RPA/issues/3/comments","statuses_url":"https://api.github.com/repos/pauloborba/RPA/statuses/6313c48c7a5acc065bb4d3aef1f6ab797d60825d","head":{"label":"Trakton:master","ref":"master","sha":"6313c48c7a5acc065bb4d3aef1f6ab797d60825d","user":{"login":"Trakton","id":13110902,"avatar_url":"https://avatars.githubusercontent.com/u/13110902?v=3","gravatar_id":"","url":"https://api.github.com/users/Trakton","html_url":"https://github.com/Trakton","followers_url":"https://api.github.com/users/Trakton/followers","following_url":"https://api.github.com/users/Trakton/following{/other_user}","gists_url":"https://api.github.com/users/Trakton/gists{/gist_id}","starred_url":"https://api.github.com/users/Trakton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trakton/subscriptions","organizations_url":"https://api.github.com/users/Trakton/orgs","repos_url":"https://api.github.com/users/Trakton/repos","events_url":"https://api.github.com/users/Trakton/events{/privacy}","received_events_url":"https://api.github.com/users/Trakton/received_events","type":"User","site_admin":false},"repo":{"id":70735010,"name":"RPA","full_name":"Trakton/RPA","owner":{"login":"Trakton","id":13110902,"avatar_url":"https://avatars.githubusercontent.com/u/13110902?v=3","gravatar_id":"","url":"https://api.github.com/users/Trakton","html_url":"https://github.com/Trakton","followers_url":"https://api.github.com/users/Trakton/followers","following_url":"https://api.github.com/users/Trakton/following{/other_user}","gists_url":"https://api.github.com/users/Trakton/gists{/gist_id}","starred_url":"https://api.github.com/users/Trakton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Trakton/subscriptions","organizations_url":"https://api.github.com/users/Trakton/orgs","repos_url":"https://api.github.com/users/Trakton/repos","events_url":"https://api.github.com/users/Trakton/events{/privacy}","received_events_url":"https://api.github.com/users/Trakton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Trakton/RPA","description":null,"fork":true,"url":"https://api.github.com/repos/Trakton/RPA","forks_url":"https://api.github.com/repos/Trakton/RPA/forks","keys_url":"https://api.github.com/repos/Trakton/RPA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Trakton/RPA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Trakton/RPA/teams","hooks_url":"https://api.github.com/repos/Trakton/RPA/hooks","issue_events_url":"https://api.github.com/repos/Trakton/RPA/issues/events{/number}","events_url":"https://api.github.com/repos/Trakton/RPA/events","assignees_url":"https://api.github.com/repos/Trakton/RPA/assignees{/user}","branches_url":"https://api.github.com/repos/Trakton/RPA/branches{/branch}","tags_url":"https://api.github.com/repos/Trakton/RPA/tags","blobs_url":"https://api.github.com/repos/Trakton/RPA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Trakton/RPA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Trakton/RPA/git/refs{/sha}","trees_url":"https://api.github.com/repos/Trakton/RPA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Trakton/RPA/statuses/{sha}","languages_url":"https://api.github.com/repos/Trakton/RPA/languages","stargazers_url":"https://api.github.com/repos/Trakton/RPA/stargazers","contributors_url":"https://api.github.com/repos/Trakton/RPA/contributors","subscribers_url":"https://api.github.com/repos/Trakton/RPA/subscribers","subscription_url":"https://api.github.com/repos/Trakton/RPA/subscription","commits_url":"https://api.github.com/repos/Trakton/RPA/commits{/sha}","git_commits_url":"https://api.github.com/repos/Trakton/RPA/git/commits{/sha}","comments_url":"https://api.github.com/repos/Trakton/RPA/comments{/number}","issue_comment_url":"https://api.github.com/repos/Trakton/RPA/issues/comments{/number}","contents_url":"https://api.github.com/repos/Trakton/RPA/contents/{+path}","compare_url":"https://api.github.com/repos/Trakton/RPA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Trakton/RPA/merges","archive_url":"https://api.github.com/repos/Trakton/RPA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Trakton/RPA/downloads","issues_url":"https://api.github.com/repos/Trakton/RPA/issues{/number}","pulls_url":"https://api.github.com/repos/Trakton/RPA/pulls{/number}","milestones_url":"https://api.github.com/repos/Trakton/RPA/milestones{/number}","notifications_url":"https://api.github.com/repos/Trakton/RPA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Trakton/RPA/labels{/name}","releases_url":"https://api.github.com/repos/Trakton/RPA/releases{/id}","deployments_url":"https://api.github.com/repos/Trakton/RPA/deployments","created_at":"2016-10-12T19:38:42Z","updated_at":"2016-10-12T19:38:44Z","pushed_at":"2016-11-07T00:46:22Z","git_url":"git://github.com/Trakton/RPA.git","ssh_url":"git@github.com:Trakton/RPA.git","clone_url":"https://github.com/Trakton/RPA.git","svn_url":"https://github.com/Trakton/RPA","homepage":null,"size":13976,"stargazers_count":0,"watchers_count":0,"language":"Groovy","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":"master"}},"base":{"label":"pauloborba:master","ref":"master","sha":"203fc16d6e6843304b0f9fcdac2a9cd2b9145068","user":{"login":"pauloborba","id":1207332,"avatar_url":"https://avatars.githubusercontent.com/u/1207332?v=3","gravatar_id":"","url":"https://api.github.com/users/pauloborba","html_url":"https://github.com/pauloborba","followers_url":"https://api.github.com/users/pauloborba/followers","following_url":"https://api.github.com/users/pauloborba/following{/other_user}","gists_url":"https://api.github.com/users/pauloborba/gists{/gist_id}","starred_url":"https://api.github.com/users/pauloborba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pauloborba/subscriptions","organizations_url":"https://api.github.com/users/pauloborba/orgs","repos_url":"https://api.github.com/users/pauloborba/repos","events_url":"https://api.github.com/users/pauloborba/events{/privacy}","received_events_url":"https://api.github.com/users/pauloborba/received_events","type":"User","site_admin":false},"repo":{"id":66493392,"name":"RPA","full_name":"pauloborba/RPA","owner":{"login":"pauloborba","id":1207332,"avatar_url":"https://avatars.githubusercontent.com/u/1207332?v=3","gravatar_id":"","url":"https://api.github.com/users/pauloborba","html_url":"https://github.com/pauloborba","followers_url":"https://api.github.com/users/pauloborba/followers","following_url":"https://api.github.com/users/pauloborba/following{/other_user}","gists_url":"https://api.github.com/users/pauloborba/gists{/gist_id}","starred_url":"https://api.github.com/users/pauloborba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pauloborba/subscriptions","organizations_url":"https://api.github.com/users/pauloborba/orgs","repos_url":"https://api.github.com/users/pauloborba/repos","events_url":"https://api.github.com/users/pauloborba/events{/privacy}","received_events_url":"https://api.github.com/users/pauloborba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pauloborba/RPA","description":null,"fork":false,"url":"https://api.github.com/repos/pauloborba/RPA","forks_url":"https://api.github.com/repos/pauloborba/RPA/forks","keys_url":"https://api.github.com/repos/pauloborba/RPA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pauloborba/RPA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pauloborba/RPA/teams","hooks_url":"https://api.github.com/repos/pauloborba/RPA/hooks","issue_events_url":"https://api.github.com/repos/pauloborba/RPA/issues/events{/number}","events_url":"https://api.github.com/repos/pauloborba/RPA/events","assignees_url":"https://api.github.com/repos/pauloborba/RPA/assignees{/user}","branches_url":"https://api.github.com/repos/pauloborba/RPA/branches{/branch}","tags_url":"https://api.github.com/repos/pauloborba/RPA/tags","blobs_url":"https://api.github.com/repos/pauloborba/RPA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pauloborba/RPA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pauloborba/RPA/git/refs{/sha}","trees_url":"https://api.github.com/repos/pauloborba/RPA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pauloborba/RPA/statuses/{sha}","languages_url":"https://api.github.com/repos/pauloborba/RPA/languages","stargazers_url":"https://api.github.com/repos/pauloborba/RPA/stargazers","contributors_url":"https://api.github.com/repos/pauloborba/RPA/contributors","subscribers_url":"https://api.github.com/repos/pauloborba/RPA/subscribers","subscription_url":"https://api.github.com/repos/pauloborba/RPA/subscription","commits_url":"https://api.github.com/repos/pauloborba/RPA/commits{/sha}","git_commits_url":"https://api.github.com/repos/pauloborba/RPA/git/commits{/sha}","comments_url":"https://api.github.com/repos/pauloborba/RPA/comments{/number}","issue_comment_url":"https://api.github.com/repos/pauloborba/RPA/issues/comments{/number}","contents_url":"https://api.github.com/repos/pauloborba/RPA/contents/{+path}","compare_url":"https://api.github.com/repos/pauloborba/RPA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pauloborba/RPA/merges","archive_url":"https://api.github.com/repos/pauloborba/RPA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pauloborba/RPA/downloads","issues_url":"https://api.github.com/repos/pauloborba/RPA/issues{/number}","pulls_url":"https://api.github.com/repos/pauloborba/RPA/pulls{/number}","milestones_url":"https://api.github.com/repos/pauloborba/RPA/milestones{/number}","notifications_url":"https://api.github.com/repos/pauloborba/RPA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pauloborba/RPA/labels{/name}","releases_url":"https://api.github.com/repos/pauloborba/RPA/releases{/id}","deployments_url":"https://api.github.com/repos/pauloborba/RPA/deployments","created_at":"2016-08-24T19:31:28Z","updated_at":"2016-08-24T19:31:54Z","pushed_at":"2016-11-08T12:53:47Z","git_url":"git://github.com/pauloborba/RPA.git","ssh_url":"git@github.com:pauloborba/RPA.git","clone_url":"https://github.com/pauloborba/RPA.git","svn_url":"https://github.com/pauloborba/RPA","homepage":null,"size":33694,"stargazers_count":0,"watchers_count":0,"language":"Groovy","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":8,"forks":10,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pauloborba/RPA/pulls/3"},"html":{"href":"https://github.com/pauloborba/RPA/pull/3"},"issue":{"href":"https://api.github.com/repos/pauloborba/RPA/issues/3"},"comments":{"href":"https://api.github.com/repos/pauloborba/RPA/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/pauloborba/RPA/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/pauloborba/RPA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pauloborba/RPA/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/pauloborba/RPA/statuses/6313c48c7a5acc065bb4d3aef1f6ab797d60825d"}}}}
{"actor":{"display_login":"dgmneto"}}