{"action":"created","comment":{"url":"https://api.github.com/repos/indico/indico/pulls/comments/98229492","pull_request_review_id":18856175,"id":98229492,"diff_hunk":"@@ -164,3 +168,86 @@ def delete_paper_template(template):\n     db.session.delete(template)\n     db.session.flush()\n     logger.info('Paper template %r deleted by %r', template, session.user)\n+\n+\n+def create_review(paper, type_, user, review_data, questions_data):\n+    review = PaperReview(revision=paper.last_revision, type=type_.instance, user=user)\n+    review.populate_from_dict(review_data)\n+    log_data = {}\n+    for question in paper.event_new.cfp.get_questions_from_review_type(type_.instance):\n+        value = int(questions_data['question_{}'.format(question.id)])\n+        review.ratings.append(PaperReviewRating(question=question, value=value))\n+        log_data[question.text] = value\n+    db.session.flush()\n+    logger.info(\"Paper %s received a review of type %s by %s\", paper, type_, user)\n+    log_data.update({\n+        'Type': unicode(type_.title),\n+        'Action': orig_string(review.proposed_action.title),\n+        'Comment': review.comment\n+    })\n+    paper.event_new.log(EventLogRealm.management, EventLogKind.positive, 'Papers',\n+                        'Paper for contribution {} reviewed'.format(paper.contribution.verbose_title),\n+                        user, data=log_data)\n+    return review\n+\n+\n+def update_review(review, review_data, questions_data):\n+    paper = review.revision.paper\n+    event = paper.event_new\n+    changes = review.populate_from_dict(review_data)\n+    review.modified_dt = now_utc()\n+    log_fields = {}\n+    for question in event.cfp.get_questions_from_review_type(review.type):\n+        field_name = 'question_{}'.format(question.id)\n+        rating = question.get_review_rating(review, allow_create=True)\n+        old_value = rating.value\n+        rating.value = int(questions_data[field_name])\n+        if old_value != rating.value:\n+            changes[field_name] = (old_value, rating.value)\n+            log_fields[field_name] = {\n+                'title': question.text,\n+                'type': 'number'\n+            }\n+    db.session.flush()\n+    logger.info(\"Paper review %s modified\", review)\n+    log_fields.update({\n+        'proposed_action': 'Action',\n+        'comment': 'Comment'\n+    })\n+    event.log(EventLogRealm.management, EventLogKind.change, 'Papers',\n+              'Review for paper {} modified'.format(paper.verbose_title),\n+              session.user, data={'Changes': make_diff_log(changes, log_fields)})\n+\n+\n+@no_autoflush\n+def create_comment(paper, comment_data, user):","path":"indico/modules/events/papers/operations.py","position":76,"original_position":76,"commit_id":"4c1448399cb97f6b329ec4d3b3ae4ca18c47eb65","original_commit_id":"4c1448399cb97f6b329ec4d3b3ae4ca18c47eb65","user":{"login":"OmeGak","id":716307,"avatar_url":"https://avatars.githubusercontent.com/u/716307?v=3","gravatar_id":"","url":"https://api.github.com/users/OmeGak","html_url":"https://github.com/OmeGak","followers_url":"https://api.github.com/users/OmeGak/followers","following_url":"https://api.github.com/users/OmeGak/following{/other_user}","gists_url":"https://api.github.com/users/OmeGak/gists{/gist_id}","starred_url":"https://api.github.com/users/OmeGak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OmeGak/subscriptions","organizations_url":"https://api.github.com/users/OmeGak/orgs","repos_url":"https://api.github.com/users/OmeGak/repos","events_url":"https://api.github.com/users/OmeGak/events{/privacy}","received_events_url":"https://api.github.com/users/OmeGak/received_events","type":"User","site_admin":false},"body":"Same as in `update_comment` I would rewrite this function to explicit in the arguments.","created_at":"2017-01-27T15:49:56Z","updated_at":"2017-01-27T15:55:15Z","html_url":"https://github.com/indico/indico/pull/2793#discussion_r98229492","pull_request_url":"https://api.github.com/repos/indico/indico/pulls/2793","_links":{"self":{"href":"https://api.github.com/repos/indico/indico/pulls/comments/98229492"},"html":{"href":"https://github.com/indico/indico/pull/2793#discussion_r98229492"},"pull_request":{"href":"https://api.github.com/repos/indico/indico/pulls/2793"}}},"pull_request":{"url":"https://api.github.com/repos/indico/indico/pulls/2793","id":102237803,"html_url":"https://github.com/indico/indico/pull/2793","diff_url":"https://github.com/indico/indico/pull/2793.diff","patch_url":"https://github.com/indico/indico/pull/2793.patch","issue_url":"https://api.github.com/repos/indico/indico/issues/2793","number":2793,"state":"open","locked":false,"title":"Paper timeline","user":{"login":"nop33","id":1579899,"avatar_url":"https://avatars.githubusercontent.com/u/1579899?v=3","gravatar_id":"","url":"https://api.github.com/users/nop33","html_url":"https://github.com/nop33","followers_url":"https://api.github.com/users/nop33/followers","following_url":"https://api.github.com/users/nop33/following{/other_user}","gists_url":"https://api.github.com/users/nop33/gists{/gist_id}","starred_url":"https://api.github.com/users/nop33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nop33/subscriptions","organizations_url":"https://api.github.com/users/nop33/orgs","repos_url":"https://api.github.com/users/nop33/repos","events_url":"https://api.github.com/users/nop33/events{/privacy}","received_events_url":"https://api.github.com/users/nop33/received_events","type":"User","site_admin":false},"body":"This PR includes:\r\n* Displaying the information and files of the 1st submitted revision\r\n* Allows commenting\r\n* Allows reviewing\r\n\r\nThings to be included in the next PR:\r\n* Allow judging\r\n* Display info of every other revision\r\n* Check that all permissions work fine\r\n* ?\r\n\r\nWhen merged, execute:\r\n\r\n```sql\r\nALTER TABLE event_paper_reviewing.review_comments\r\n        ADD COLUMN visibility smallint NOT NULL;\r\n\r\nALTER TABLE event_paper_reviewing.review_comments\r\n        ADD CONSTRAINT ck_review_comments_valid_enum_visibility CHECK ((visibility = ANY (ARRAY[1, 2, 3, 4])));\r\n```\r\n","created_at":"2017-01-19T10:20:19Z","updated_at":"2017-01-27T15:55:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fdb8b5e953f2a9e3226cb73112107789f299c75","assignee":{"login":"OmeGak","id":716307,"avatar_url":"https://avatars.githubusercontent.com/u/716307?v=3","gravatar_id":"","url":"https://api.github.com/users/OmeGak","html_url":"https://github.com/OmeGak","followers_url":"https://api.github.com/users/OmeGak/followers","following_url":"https://api.github.com/users/OmeGak/following{/other_user}","gists_url":"https://api.github.com/users/OmeGak/gists{/gist_id}","starred_url":"https://api.github.com/users/OmeGak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OmeGak/subscriptions","organizations_url":"https://api.github.com/users/OmeGak/orgs","repos_url":"https://api.github.com/users/OmeGak/repos","events_url":"https://api.github.com/users/OmeGak/events{/privacy}","received_events_url":"https://api.github.com/users/OmeGak/received_events","type":"User","site_admin":false},"assignees":[{"login":"OmeGak","id":716307,"avatar_url":"https://avatars.githubusercontent.com/u/716307?v=3","gravatar_id":"","url":"https://api.github.com/users/OmeGak","html_url":"https://github.com/OmeGak","followers_url":"https://api.github.com/users/OmeGak/followers","following_url":"https://api.github.com/users/OmeGak/following{/other_user}","gists_url":"https://api.github.com/users/OmeGak/gists{/gist_id}","starred_url":"https://api.github.com/users/OmeGak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OmeGak/subscriptions","organizations_url":"https://api.github.com/users/OmeGak/orgs","repos_url":"https://api.github.com/users/OmeGak/repos","events_url":"https://api.github.com/users/OmeGak/events{/privacy}","received_events_url":"https://api.github.com/users/OmeGak/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/indico/indico/pulls/2793/commits","review_comments_url":"https://api.github.com/repos/indico/indico/pulls/2793/comments","review_comment_url":"https://api.github.com/repos/indico/indico/pulls/comments{/number}","comments_url":"https://api.github.com/repos/indico/indico/issues/2793/comments","statuses_url":"https://api.github.com/repos/indico/indico/statuses/4c1448399cb97f6b329ec4d3b3ae4ca18c47eb65","head":{"label":"nop33:wip/paper-timeline","ref":"wip/paper-timeline","sha":"4c1448399cb97f6b329ec4d3b3ae4ca18c47eb65","user":{"login":"nop33","id":1579899,"avatar_url":"https://avatars.githubusercontent.com/u/1579899?v=3","gravatar_id":"","url":"https://api.github.com/users/nop33","html_url":"https://github.com/nop33","followers_url":"https://api.github.com/users/nop33/followers","following_url":"https://api.github.com/users/nop33/following{/other_user}","gists_url":"https://api.github.com/users/nop33/gists{/gist_id}","starred_url":"https://api.github.com/users/nop33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nop33/subscriptions","organizations_url":"https://api.github.com/users/nop33/orgs","repos_url":"https://api.github.com/users/nop33/repos","events_url":"https://api.github.com/users/nop33/events{/privacy}","received_events_url":"https://api.github.com/users/nop33/received_events","type":"User","site_admin":false},"repo":{"id":22684703,"name":"indico","full_name":"nop33/indico","owner":{"login":"nop33","id":1579899,"avatar_url":"https://avatars.githubusercontent.com/u/1579899?v=3","gravatar_id":"","url":"https://api.github.com/users/nop33","html_url":"https://github.com/nop33","followers_url":"https://api.github.com/users/nop33/followers","following_url":"https://api.github.com/users/nop33/following{/other_user}","gists_url":"https://api.github.com/users/nop33/gists{/gist_id}","starred_url":"https://api.github.com/users/nop33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nop33/subscriptions","organizations_url":"https://api.github.com/users/nop33/orgs","repos_url":"https://api.github.com/users/nop33/repos","events_url":"https://api.github.com/users/nop33/events{/privacy}","received_events_url":"https://api.github.com/users/nop33/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nop33/indico","description":"The Indico Project (mirror)","fork":true,"url":"https://api.github.com/repos/nop33/indico","forks_url":"https://api.github.com/repos/nop33/indico/forks","keys_url":"https://api.github.com/repos/nop33/indico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nop33/indico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nop33/indico/teams","hooks_url":"https://api.github.com/repos/nop33/indico/hooks","issue_events_url":"https://api.github.com/repos/nop33/indico/issues/events{/number}","events_url":"https://api.github.com/repos/nop33/indico/events","assignees_url":"https://api.github.com/repos/nop33/indico/assignees{/user}","branches_url":"https://api.github.com/repos/nop33/indico/branches{/branch}","tags_url":"https://api.github.com/repos/nop33/indico/tags","blobs_url":"https://api.github.com/repos/nop33/indico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nop33/indico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nop33/indico/git/refs{/sha}","trees_url":"https://api.github.com/repos/nop33/indico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nop33/indico/statuses/{sha}","languages_url":"https://api.github.com/repos/nop33/indico/languages","stargazers_url":"https://api.github.com/repos/nop33/indico/stargazers","contributors_url":"https://api.github.com/repos/nop33/indico/contributors","subscribers_url":"https://api.github.com/repos/nop33/indico/subscribers","subscription_url":"https://api.github.com/repos/nop33/indico/subscription","commits_url":"https://api.github.com/repos/nop33/indico/commits{/sha}","git_commits_url":"https://api.github.com/repos/nop33/indico/git/commits{/sha}","comments_url":"https://api.github.com/repos/nop33/indico/comments{/number}","issue_comment_url":"https://api.github.com/repos/nop33/indico/issues/comments{/number}","contents_url":"https://api.github.com/repos/nop33/indico/contents/{+path}","compare_url":"https://api.github.com/repos/nop33/indico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nop33/indico/merges","archive_url":"https://api.github.com/repos/nop33/indico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nop33/indico/downloads","issues_url":"https://api.github.com/repos/nop33/indico/issues{/number}","pulls_url":"https://api.github.com/repos/nop33/indico/pulls{/number}","milestones_url":"https://api.github.com/repos/nop33/indico/milestones{/number}","notifications_url":"https://api.github.com/repos/nop33/indico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nop33/indico/labels{/name}","releases_url":"https://api.github.com/repos/nop33/indico/releases{/id}","deployments_url":"https://api.github.com/repos/nop33/indico/deployments","created_at":"2014-08-06T14:02:24Z","updated_at":"2016-11-01T12:55:16Z","pushed_at":"2017-01-27T14:57:58Z","git_url":"git://github.com/nop33/indico.git","ssh_url":"git@github.com:nop33/indico.git","clone_url":"https://github.com/nop33/indico.git","svn_url":"https://github.com/nop33/indico","homepage":"http://indico-software.org","size":195128,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"devel"}},"base":{"label":"indico:devel","ref":"devel","sha":"ae9fd5fa2e86f0e87f07f752a47cdd2c50cf198b","user":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"repo":{"id":2113067,"name":"indico","full_name":"indico/indico","owner":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/indico/indico","description":"The Indico Project","fork":false,"url":"https://api.github.com/repos/indico/indico","forks_url":"https://api.github.com/repos/indico/indico/forks","keys_url":"https://api.github.com/repos/indico/indico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/indico/indico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/indico/indico/teams","hooks_url":"https://api.github.com/repos/indico/indico/hooks","issue_events_url":"https://api.github.com/repos/indico/indico/issues/events{/number}","events_url":"https://api.github.com/repos/indico/indico/events","assignees_url":"https://api.github.com/repos/indico/indico/assignees{/user}","branches_url":"https://api.github.com/repos/indico/indico/branches{/branch}","tags_url":"https://api.github.com/repos/indico/indico/tags","blobs_url":"https://api.github.com/repos/indico/indico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/indico/indico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/indico/indico/git/refs{/sha}","trees_url":"https://api.github.com/repos/indico/indico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/indico/indico/statuses/{sha}","languages_url":"https://api.github.com/repos/indico/indico/languages","stargazers_url":"https://api.github.com/repos/indico/indico/stargazers","contributors_url":"https://api.github.com/repos/indico/indico/contributors","subscribers_url":"https://api.github.com/repos/indico/indico/subscribers","subscription_url":"https://api.github.com/repos/indico/indico/subscription","commits_url":"https://api.github.com/repos/indico/indico/commits{/sha}","git_commits_url":"https://api.github.com/repos/indico/indico/git/commits{/sha}","comments_url":"https://api.github.com/repos/indico/indico/comments{/number}","issue_comment_url":"https://api.github.com/repos/indico/indico/issues/comments{/number}","contents_url":"https://api.github.com/repos/indico/indico/contents/{+path}","compare_url":"https://api.github.com/repos/indico/indico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/indico/indico/merges","archive_url":"https://api.github.com/repos/indico/indico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/indico/indico/downloads","issues_url":"https://api.github.com/repos/indico/indico/issues{/number}","pulls_url":"https://api.github.com/repos/indico/indico/pulls{/number}","milestones_url":"https://api.github.com/repos/indico/indico/milestones{/number}","notifications_url":"https://api.github.com/repos/indico/indico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/indico/indico/labels{/name}","releases_url":"https://api.github.com/repos/indico/indico/releases{/id}","deployments_url":"https://api.github.com/repos/indico/indico/deployments","created_at":"2011-07-27T13:56:30Z","updated_at":"2017-01-25T16:20:03Z","pushed_at":"2017-01-27T15:40:58Z","git_url":"git://github.com/indico/indico.git","ssh_url":"git@github.com:indico/indico.git","clone_url":"https://github.com/indico/indico.git","svn_url":"https://github.com/indico/indico","homepage":"http://indico-software.org","size":195649,"stargazers_count":186,"watchers_count":186,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":639,"forks":88,"open_issues":639,"watchers":186,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/indico/indico/pulls/2793"},"html":{"href":"https://github.com/indico/indico/pull/2793"},"issue":{"href":"https://api.github.com/repos/indico/indico/issues/2793"},"comments":{"href":"https://api.github.com/repos/indico/indico/issues/2793/comments"},"review_comments":{"href":"https://api.github.com/repos/indico/indico/pulls/2793/comments"},"review_comment":{"href":"https://api.github.com/repos/indico/indico/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/indico/indico/pulls/2793/commits"},"statuses":{"href":"https://api.github.com/repos/indico/indico/statuses/4c1448399cb97f6b329ec4d3b3ae4ca18c47eb65"}}}}
{"actor":{"display_login":"OmeGak"}}