{"action":"created","comment":{"url":"https://api.github.com/repos/oppia/oppia/pulls/comments/199366937","pull_request_review_id":133471326,"id":199366937,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTM2NjkzNw==","diff_hunk":"@@ -672,3 +673,85 @@ def construct_model_id(cls, user_id, skill_id):\n             str. The model id corresponding to the given user and skill.\n         \"\"\"\n         return '%s.%s' % (user_id, skill_id)\n+\n+\n+class UserContributionScoringModel(base_models.BaseModel):\n+    \"\"\"Model for storing the scores of a user for various suggestions created by\n+    the user. Users having scores above a particular threshold for a category\n+    can review suggestions for that category.\n+\n+    The id for this model is of the form '{{score_category}}.{{user_id}}'.\n+    \"\"\"\n+\n+    # The user id of the user.\n+    user_id = ndb.StringProperty(required=True, indexed=True)\n+    # The category of suggestion to score the user on.\n+    score_category = ndb.StringProperty(required=True, indexed=True)\n+    # The score of the user for the above category of suggestions.\n+    score = ndb.FloatProperty(required=True, indexed=True)\n+\n+    @classmethod\n+    def get_all_scores_of_user(cls, user_id):\n+        \"\"\"Gets all scores for a given user.\n+\n+        Args:\n+            user_id: str. The id of the user.\n+\n+        Returns:\n+            list(UserContributionsScoringModel). All instances for the given\n+                user.\n+        \"\"\"\n+        return cls.get_all().filter(cls.user_id == user_id).fetch()\n+\n+    @classmethod\n+    def get_all_users_with_score_above_minimum_for_category(\n+            cls, score_category):\n+        \"\"\"Gets all instances which have score above the\n+        MINIMUM_SCORE_REQUIRED_TO_REVIEW threshold for the given category.\n+\n+        Args:\n+            score_category: str. The category being queried.\n+\n+        Returns:\n+            list(UserContributionsScoringModel). All instances for the given\n+                category with scores above MINIMUM_SCORE_REQUIRED_TO_REVIEW.\n+        \"\"\"\n+        return cls.get_all().filter(\n+            cls.score_category == score_category).filter(\n+                cls.score >=\n+                suggestion_models.MINIMUM_SCORE_REQUIRED_TO_REVIEW).fetch()\n+\n+    @classmethod\n+    def get_instance_id(cls, user_id, score_category):","path":"core/storage/user/gae_models.py","position":63,"original_position":63,"commit_id":"711f157feeb431c13328a29c0e36f872d52e6979","original_commit_id":"711f157feeb431c13328a29c0e36f872d52e6979","user":{"login":"BenHenning","id":12983742,"node_id":"MDQ6VXNlcjEyOTgzNzQy","avatar_url":"https://avatars3.githubusercontent.com/u/12983742?v=4","gravatar_id":"","url":"https://api.github.com/users/BenHenning","html_url":"https://github.com/BenHenning","followers_url":"https://api.github.com/users/BenHenning/followers","following_url":"https://api.github.com/users/BenHenning/following{/other_user}","gists_url":"https://api.github.com/users/BenHenning/gists{/gist_id}","starred_url":"https://api.github.com/users/BenHenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenHenning/subscriptions","organizations_url":"https://api.github.com/users/BenHenning/orgs","repos_url":"https://api.github.com/users/BenHenning/repos","events_url":"https://api.github.com/users/BenHenning/events{/privacy}","received_events_url":"https://api.github.com/users/BenHenning/received_events","type":"User","site_admin":false},"body":"Can this be made private (e.g. be prefixed with ``_``)?","created_at":"2018-07-02T00:29:48Z","updated_at":"2018-07-02T00:30:29Z","html_url":"https://github.com/oppia/oppia/pull/5128#discussion_r199366937","pull_request_url":"https://api.github.com/repos/oppia/oppia/pulls/5128","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments/199366937"},"html":{"href":"https://github.com/oppia/oppia/pull/5128#discussion_r199366937"},"pull_request":{"href":"https://api.github.com/repos/oppia/oppia/pulls/5128"}}},"pull_request":{"url":"https://api.github.com/repos/oppia/oppia/pulls/5128","id":196029166,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2MDI5MTY2","html_url":"https://github.com/oppia/oppia/pull/5128","diff_url":"https://github.com/oppia/oppia/pull/5128.diff","patch_url":"https://github.com/oppia/oppia/pull/5128.patch","issue_url":"https://api.github.com/repos/oppia/oppia/issues/5128","number":5128,"state":"open","locked":false,"title":"Generalised Review System Milestone 2: Add user contribution scoring models","user":{"login":"nithusha21","id":11898234,"node_id":"MDQ6VXNlcjExODk4MjM0","avatar_url":"https://avatars2.githubusercontent.com/u/11898234?v=4","gravatar_id":"","url":"https://api.github.com/users/nithusha21","html_url":"https://github.com/nithusha21","followers_url":"https://api.github.com/users/nithusha21/followers","following_url":"https://api.github.com/users/nithusha21/following{/other_user}","gists_url":"https://api.github.com/users/nithusha21/gists{/gist_id}","starred_url":"https://api.github.com/users/nithusha21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nithusha21/subscriptions","organizations_url":"https://api.github.com/users/nithusha21/orgs","repos_url":"https://api.github.com/users/nithusha21/repos","events_url":"https://api.github.com/users/nithusha21/events{/privacy}","received_events_url":"https://api.github.com/users/nithusha21/received_events","type":"User","site_admin":false},"body":"## Explanation\r\nAdds model and related query functions for the user scoring model. Will connect it to the suggestions framework (updating scores, and adding permissions for people with high scores to review) in a follow-up PR.\r\n\r\nPTAL @anmolshkl. Thanks!\r\n\r\n## Checklist\r\n- [ ] The PR title starts with \"Fix #bugnum: \", followed by a short, clear summary of the changes.\r\n- [ ] The PR explanation includes the words \"Fixes #bugnum: ...\".\r\n- [x] The linter/Karma presubmit checks have passed.\r\n  - These should run automatically, but if not, you can manually trigger them locally using `python scripts/pre_commit_linter.py` and `bash scripts/run_frontend_tests.sh`.\r\n- [x] The PR is made from a branch that's **not** called \"develop\".\r\n- [x] The PR follows the [style guide](https://github.com/oppia/oppia/wiki/Coding-style-guide).\r\n- [x] The PR is assigned to an appropriate reviewer.\r\n  - If you're a new contributor, please ask on [Gitter](https://gitter.im/oppia/oppia-chat) for someone to assign a reviewer.\r\n  - If you're not sure who the appropriate reviewer is, please assign to the issue's \"owner\" -- see the \"talk-to\" label on the issue.\r\n","created_at":"2018-06-20T05:57:56Z","updated_at":"2018-07-02T00:30:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89a81d94fc6a2e8540e72ee86473882f6aaa8dab","assignee":{"login":"anmolshkl","id":6338799,"node_id":"MDQ6VXNlcjYzMzg3OTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6338799?v=4","gravatar_id":"","url":"https://api.github.com/users/anmolshkl","html_url":"https://github.com/anmolshkl","followers_url":"https://api.github.com/users/anmolshkl/followers","following_url":"https://api.github.com/users/anmolshkl/following{/other_user}","gists_url":"https://api.github.com/users/anmolshkl/gists{/gist_id}","starred_url":"https://api.github.com/users/anmolshkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anmolshkl/subscriptions","organizations_url":"https://api.github.com/users/anmolshkl/orgs","repos_url":"https://api.github.com/users/anmolshkl/repos","events_url":"https://api.github.com/users/anmolshkl/events{/privacy}","received_events_url":"https://api.github.com/users/anmolshkl/received_events","type":"User","site_admin":false},"assignees":[{"login":"anmolshkl","id":6338799,"node_id":"MDQ6VXNlcjYzMzg3OTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6338799?v=4","gravatar_id":"","url":"https://api.github.com/users/anmolshkl","html_url":"https://github.com/anmolshkl","followers_url":"https://api.github.com/users/anmolshkl/followers","following_url":"https://api.github.com/users/anmolshkl/following{/other_user}","gists_url":"https://api.github.com/users/anmolshkl/gists{/gist_id}","starred_url":"https://api.github.com/users/anmolshkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anmolshkl/subscriptions","organizations_url":"https://api.github.com/users/anmolshkl/orgs","repos_url":"https://api.github.com/users/anmolshkl/repos","events_url":"https://api.github.com/users/anmolshkl/events{/privacy}","received_events_url":"https://api.github.com/users/anmolshkl/received_events","type":"User","site_admin":false},{"login":"BenHenning","id":12983742,"node_id":"MDQ6VXNlcjEyOTgzNzQy","avatar_url":"https://avatars3.githubusercontent.com/u/12983742?v=4","gravatar_id":"","url":"https://api.github.com/users/BenHenning","html_url":"https://github.com/BenHenning","followers_url":"https://api.github.com/users/BenHenning/followers","following_url":"https://api.github.com/users/BenHenning/following{/other_user}","gists_url":"https://api.github.com/users/BenHenning/gists{/gist_id}","starred_url":"https://api.github.com/users/BenHenning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenHenning/subscriptions","organizations_url":"https://api.github.com/users/BenHenning/orgs","repos_url":"https://api.github.com/users/BenHenning/repos","events_url":"https://api.github.com/users/BenHenning/events{/privacy}","received_events_url":"https://api.github.com/users/BenHenning/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/oppia/oppia/pulls/5128/commits","review_comments_url":"https://api.github.com/repos/oppia/oppia/pulls/5128/comments","review_comment_url":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/5128/comments","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/711f157feeb431c13328a29c0e36f872d52e6979","head":{"label":"nithusha21:user-scoring-models","ref":"user-scoring-models","sha":"711f157feeb431c13328a29c0e36f872d52e6979","user":{"login":"nithusha21","id":11898234,"node_id":"MDQ6VXNlcjExODk4MjM0","avatar_url":"https://avatars2.githubusercontent.com/u/11898234?v=4","gravatar_id":"","url":"https://api.github.com/users/nithusha21","html_url":"https://github.com/nithusha21","followers_url":"https://api.github.com/users/nithusha21/followers","following_url":"https://api.github.com/users/nithusha21/following{/other_user}","gists_url":"https://api.github.com/users/nithusha21/gists{/gist_id}","starred_url":"https://api.github.com/users/nithusha21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nithusha21/subscriptions","organizations_url":"https://api.github.com/users/nithusha21/orgs","repos_url":"https://api.github.com/users/nithusha21/repos","events_url":"https://api.github.com/users/nithusha21/events{/privacy}","received_events_url":"https://api.github.com/users/nithusha21/received_events","type":"User","site_admin":false},"repo":{"id":111784747,"node_id":"MDEwOlJlcG9zaXRvcnkxMTE3ODQ3NDc=","name":"oppia","full_name":"nithusha21/oppia","owner":{"login":"nithusha21","id":11898234,"node_id":"MDQ6VXNlcjExODk4MjM0","avatar_url":"https://avatars2.githubusercontent.com/u/11898234?v=4","gravatar_id":"","url":"https://api.github.com/users/nithusha21","html_url":"https://github.com/nithusha21","followers_url":"https://api.github.com/users/nithusha21/followers","following_url":"https://api.github.com/users/nithusha21/following{/other_user}","gists_url":"https://api.github.com/users/nithusha21/gists{/gist_id}","starred_url":"https://api.github.com/users/nithusha21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nithusha21/subscriptions","organizations_url":"https://api.github.com/users/nithusha21/orgs","repos_url":"https://api.github.com/users/nithusha21/repos","events_url":"https://api.github.com/users/nithusha21/events{/privacy}","received_events_url":"https://api.github.com/users/nithusha21/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nithusha21/oppia","description":"Tool for collaboratively building interactive lessons.","fork":true,"url":"https://api.github.com/repos/nithusha21/oppia","forks_url":"https://api.github.com/repos/nithusha21/oppia/forks","keys_url":"https://api.github.com/repos/nithusha21/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nithusha21/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nithusha21/oppia/teams","hooks_url":"https://api.github.com/repos/nithusha21/oppia/hooks","issue_events_url":"https://api.github.com/repos/nithusha21/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/nithusha21/oppia/events","assignees_url":"https://api.github.com/repos/nithusha21/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/nithusha21/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/nithusha21/oppia/tags","blobs_url":"https://api.github.com/repos/nithusha21/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nithusha21/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nithusha21/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/nithusha21/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nithusha21/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/nithusha21/oppia/languages","stargazers_url":"https://api.github.com/repos/nithusha21/oppia/stargazers","contributors_url":"https://api.github.com/repos/nithusha21/oppia/contributors","subscribers_url":"https://api.github.com/repos/nithusha21/oppia/subscribers","subscription_url":"https://api.github.com/repos/nithusha21/oppia/subscription","commits_url":"https://api.github.com/repos/nithusha21/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/nithusha21/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/nithusha21/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/nithusha21/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/nithusha21/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/nithusha21/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nithusha21/oppia/merges","archive_url":"https://api.github.com/repos/nithusha21/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nithusha21/oppia/downloads","issues_url":"https://api.github.com/repos/nithusha21/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/nithusha21/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/nithusha21/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/nithusha21/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nithusha21/oppia/labels{/name}","releases_url":"https://api.github.com/repos/nithusha21/oppia/releases{/id}","deployments_url":"https://api.github.com/repos/nithusha21/oppia/deployments","created_at":"2017-11-23T08:43:13Z","updated_at":"2018-06-29T10:36:10Z","pushed_at":"2018-06-30T11:42:21Z","git_url":"git://github.com/nithusha21/oppia.git","ssh_url":"git@github.com:nithusha21/oppia.git","clone_url":"https://github.com/nithusha21/oppia.git","svn_url":"https://github.com/nithusha21/oppia","homepage":"https://www.oppia.org","size":104651,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"oppia:develop","ref":"develop","sha":"53f4aa21e4e5b542433f2e3468d37794b6edf93d","user":{"login":"oppia","id":11620230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjIwMjMw","avatar_url":"https://avatars1.githubusercontent.com/u/11620230?v=4","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"repo":{"id":40687563,"node_id":"MDEwOlJlcG9zaXRvcnk0MDY4NzU2Mw==","name":"oppia","full_name":"oppia/oppia","owner":{"login":"oppia","id":11620230,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNjIwMjMw","avatar_url":"https://avatars1.githubusercontent.com/u/11620230?v=4","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/oppia/oppia","description":"Tool for collaboratively building interactive lessons.","fork":false,"url":"https://api.github.com/repos/oppia/oppia","forks_url":"https://api.github.com/repos/oppia/oppia/forks","keys_url":"https://api.github.com/repos/oppia/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oppia/oppia/teams","hooks_url":"https://api.github.com/repos/oppia/oppia/hooks","issue_events_url":"https://api.github.com/repos/oppia/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/oppia/oppia/events","assignees_url":"https://api.github.com/repos/oppia/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/oppia/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/oppia/oppia/tags","blobs_url":"https://api.github.com/repos/oppia/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oppia/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oppia/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/oppia/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/oppia/oppia/languages","stargazers_url":"https://api.github.com/repos/oppia/oppia/stargazers","contributors_url":"https://api.github.com/repos/oppia/oppia/contributors","subscribers_url":"https://api.github.com/repos/oppia/oppia/subscribers","subscription_url":"https://api.github.com/repos/oppia/oppia/subscription","commits_url":"https://api.github.com/repos/oppia/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/oppia/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/oppia/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/oppia/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/oppia/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/oppia/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oppia/oppia/merges","archive_url":"https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oppia/oppia/downloads","issues_url":"https://api.github.com/repos/oppia/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/oppia/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/oppia/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oppia/oppia/labels{/name}","releases_url":"https://api.github.com/repos/oppia/oppia/releases{/id}","deployments_url":"https://api.github.com/repos/oppia/oppia/deployments","created_at":"2015-08-14T00:16:14Z","updated_at":"2018-07-01T20:49:13Z","pushed_at":"2018-07-01T22:55:15Z","git_url":"git://github.com/oppia/oppia.git","ssh_url":"git@github.com:oppia/oppia.git","clone_url":"https://github.com/oppia/oppia.git","svn_url":"https://github.com/oppia/oppia","homepage":"https://www.oppia.org","size":104658,"stargazers_count":680,"watchers_count":680,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":652,"mirror_url":null,"archived":false,"open_issues_count":331,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":652,"open_issues":331,"watchers":680,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/5128"},"html":{"href":"https://github.com/oppia/oppia/pull/5128"},"issue":{"href":"https://api.github.com/repos/oppia/oppia/issues/5128"},"comments":{"href":"https://api.github.com/repos/oppia/oppia/issues/5128/comments"},"review_comments":{"href":"https://api.github.com/repos/oppia/oppia/pulls/5128/comments"},"review_comment":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/oppia/oppia/pulls/5128/commits"},"statuses":{"href":"https://api.github.com/repos/oppia/oppia/statuses/711f157feeb431c13328a29c0e36f872d52e6979"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"BenHenning"}}