{"action":"created","comment":{"url":"https://api.github.com/repos/duckduckgo/community-platform/pulls/comments/60480456","id":60480456,"diff_hunk":"@@ -458,74 +458,89 @@\n                 return parseInt(moment().diff(date, \"days\", true));\n             }\n \n+            // Priority is higher when:\n+            // - last activity (especially comment) is by a contributor (non-admin)\n+            // - last activity happened long ago (the older the activity, the higher the priority)\n+            function rank_ia(ia) {\n+                var priority_val, score_last_comment, score_elapsed_time, score_tags, score_mention = 0;\n+                var priority_msg = '';\n+\n+                if (ia.pr && (ia.pr.status === \"open\")) {\n+                    if (ia.last_comment) {\n+                        // Last comment\n+                        var idle_comment = elapsed_time(ia.last_comment.date);\n+                        if (ia.last_comment.admin) {\n+                            score_last_comment = -20;\n+                            score_elapsed_time = idle_comment;\n+                            priority_msg += \"- 20 (last comment by admin) \\n+ elapsed time since last comment \\n\";\n+                        } else {\n+                            score_last_comment = 20;\n+                            score_elapsed_time = (2 * idle_comment);\n+                            priority_msg += \"+ 20 (last comment by contributor) \\n+ twice the elapsed time since last comment \\n\";\n+                        }\n+                    } if (ia.last_commit) {\n+                        // Last commit\n+                        var idle_commit = elapsed_time(ia.last_commit.date);\n+                        if (ia.last_comment &&  moment.utc(ia.last_comment.date).isBefore(ia.last_commit.date)) {\n+                            score_elapsed_time += (1.5 * idle_commit);\n+                            priority_msg += \"+ 1.5 times the elapsed time since last commit (made after last comment) \\n\";\n+                        } else if ((!ia.last_comment) && (!ia.last_commit.admin)) {\n+                            score_elapsed_time += (2 * idle_commit);\n+                            priority_msg += \"+ twice the elapsed time since last commit (there are no comments in the PR) \\n\";\n+                        }\n+                    }\n+\n+                    // Priority drops if the PR is on hold\n+                    if (ia.pr && (ia.pr.status === \"open\")) {\n+                        var tags = ia.pr.tags;\n+\n+                        $.each(tags, function(idx) {\n+                            var tag = tags[idx];\n+                            if (tag.name.toLowerCase() === \"on hold\") {\n+                                 score_tags = -100;\n+                                 priority_msg += \"- 100: the PR is on hold \\n\";\n+                            } else if (tag.name.toLowerCase() === \"priority: high\") {\n+                                 score_tags = 20;\n+                                 priority_msg += \"+ 20: the PR is high priority \\n\";\n+                            }\n+                        });\n+                    }\n+\n+                    // Priority is higher if the user was mentioned in the last comment\n+                    if (ia.at_mentions && ia.at_mentions.indexOf(dev_p.data.username) !== -1) {\n+                         score_mention = 50;\n+                         priority_msg += \"+ 50: you have been @ mentioned in the last comment \\n\";\n+                    }\n+\n+                    priority_val = score_last_comment + score_elapsed_time + score_tags + score_mention;\n+\n+                    // Has a PR, so it still has more priority than IAs which don't have one\n+                    if (priority_val <= 0) {\n+                        priority_val = 1;\n+                        priority_msg += \"final value is 1: there's a PR, so it's higher priority than IAs without a PR \\n\";\n+                    }\n+                }\n+\n+                var result = {\n+                    priority: priority_val,\n+                    priority_msg: priority_msg\n+                };\n+\n+                return result;","path":"src/js/ia/IADevPipeline.js","position":72,"original_position":72,"commit_id":"01d067d6b7183b3cd962322f3895400644099cf8","original_commit_id":"01d067d6b7183b3cd962322f3895400644099cf8","user":{"login":"russellholt","id":333669,"avatar_url":"https://avatars.githubusercontent.com/u/333669?v=3","gravatar_id":"","url":"https://api.github.com/users/russellholt","html_url":"https://github.com/russellholt","followers_url":"https://api.github.com/users/russellholt/followers","following_url":"https://api.github.com/users/russellholt/following{/other_user}","gists_url":"https://api.github.com/users/russellholt/gists{/gist_id}","starred_url":"https://api.github.com/users/russellholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russellholt/subscriptions","organizations_url":"https://api.github.com/users/russellholt/orgs","repos_url":"https://api.github.com/users/russellholt/repos","events_url":"https://api.github.com/users/russellholt/events{/privacy}","received_events_url":"https://api.github.com/users/russellholt/received_events","type":"User","site_admin":false},"body":"`return { ... }; `  ?","created_at":"2016-04-20T20:22:50Z","updated_at":"2016-04-20T20:22:50Z","html_url":"https://github.com/duckduckgo/community-platform/pull/1326#discussion_r60480456","pull_request_url":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1326","_links":{"self":{"href":"https://api.github.com/repos/duckduckgo/community-platform/pulls/comments/60480456"},"html":{"href":"https://github.com/duckduckgo/community-platform/pull/1326#discussion_r60480456"},"pull_request":{"href":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1326"}}},"pull_request":{"url":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1326","id":66703097,"html_url":"https://github.com/duckduckgo/community-platform/pull/1326","diff_url":"https://github.com/duckduckgo/community-platform/pull/1326.diff","patch_url":"https://github.com/duckduckgo/community-platform/pull/1326.patch","issue_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/1326","number":1326,"state":"open","locked":false,"title":"Dev Pipeline - factor out the ranking function","user":{"login":"MariagraziaAlastra","id":3652195,"avatar_url":"https://avatars.githubusercontent.com/u/3652195?v=3","gravatar_id":"","url":"https://api.github.com/users/MariagraziaAlastra","html_url":"https://github.com/MariagraziaAlastra","followers_url":"https://api.github.com/users/MariagraziaAlastra/followers","following_url":"https://api.github.com/users/MariagraziaAlastra/following{/other_user}","gists_url":"https://api.github.com/users/MariagraziaAlastra/gists{/gist_id}","starred_url":"https://api.github.com/users/MariagraziaAlastra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MariagraziaAlastra/subscriptions","organizations_url":"https://api.github.com/users/MariagraziaAlastra/orgs","repos_url":"https://api.github.com/users/MariagraziaAlastra/repos","events_url":"https://api.github.com/users/MariagraziaAlastra/events{/privacy}","received_events_url":"https://api.github.com/users/MariagraziaAlastra/received_events","type":"User","site_admin":false},"body":"An attempt to make sorting by priority more modular and more testable.","created_at":"2016-04-15T20:51:33Z","updated_at":"2016-04-20T20:22:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd117056f5751986a40c6b7c729508a3efa89ff5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1326/commits","review_comments_url":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1326/comments","review_comment_url":"https://api.github.com/repos/duckduckgo/community-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/1326/comments","statuses_url":"https://api.github.com/repos/duckduckgo/community-platform/statuses/01d067d6b7183b3cd962322f3895400644099cf8","head":{"label":"duckduckgo:maria/ranking","ref":"maria/ranking","sha":"01d067d6b7183b3cd962322f3895400644099cf8","user":{"login":"duckduckgo","id":342708,"avatar_url":"https://avatars.githubusercontent.com/u/342708?v=3","gravatar_id":"","url":"https://api.github.com/users/duckduckgo","html_url":"https://github.com/duckduckgo","followers_url":"https://api.github.com/users/duckduckgo/followers","following_url":"https://api.github.com/users/duckduckgo/following{/other_user}","gists_url":"https://api.github.com/users/duckduckgo/gists{/gist_id}","starred_url":"https://api.github.com/users/duckduckgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duckduckgo/subscriptions","organizations_url":"https://api.github.com/users/duckduckgo/orgs","repos_url":"https://api.github.com/users/duckduckgo/repos","events_url":"https://api.github.com/users/duckduckgo/events{/privacy}","received_events_url":"https://api.github.com/users/duckduckgo/received_events","type":"Organization","site_admin":false},"repo":{"id":1751775,"name":"community-platform","full_name":"duckduckgo/community-platform","owner":{"login":"duckduckgo","id":342708,"avatar_url":"https://avatars.githubusercontent.com/u/342708?v=3","gravatar_id":"","url":"https://api.github.com/users/duckduckgo","html_url":"https://github.com/duckduckgo","followers_url":"https://api.github.com/users/duckduckgo/followers","following_url":"https://api.github.com/users/duckduckgo/following{/other_user}","gists_url":"https://api.github.com/users/duckduckgo/gists{/gist_id}","starred_url":"https://api.github.com/users/duckduckgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duckduckgo/subscriptions","organizations_url":"https://api.github.com/users/duckduckgo/orgs","repos_url":"https://api.github.com/users/duckduckgo/repos","events_url":"https://api.github.com/users/duckduckgo/events{/privacy}","received_events_url":"https://api.github.com/users/duckduckgo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/duckduckgo/community-platform","description":"DuckDuckGo Community Platform","fork":false,"url":"https://api.github.com/repos/duckduckgo/community-platform","forks_url":"https://api.github.com/repos/duckduckgo/community-platform/forks","keys_url":"https://api.github.com/repos/duckduckgo/community-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/duckduckgo/community-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/duckduckgo/community-platform/teams","hooks_url":"https://api.github.com/repos/duckduckgo/community-platform/hooks","issue_events_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/events{/number}","events_url":"https://api.github.com/repos/duckduckgo/community-platform/events","assignees_url":"https://api.github.com/repos/duckduckgo/community-platform/assignees{/user}","branches_url":"https://api.github.com/repos/duckduckgo/community-platform/branches{/branch}","tags_url":"https://api.github.com/repos/duckduckgo/community-platform/tags","blobs_url":"https://api.github.com/repos/duckduckgo/community-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/duckduckgo/community-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/duckduckgo/community-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/duckduckgo/community-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/duckduckgo/community-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/duckduckgo/community-platform/languages","stargazers_url":"https://api.github.com/repos/duckduckgo/community-platform/stargazers","contributors_url":"https://api.github.com/repos/duckduckgo/community-platform/contributors","subscribers_url":"https://api.github.com/repos/duckduckgo/community-platform/subscribers","subscription_url":"https://api.github.com/repos/duckduckgo/community-platform/subscription","commits_url":"https://api.github.com/repos/duckduckgo/community-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/duckduckgo/community-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/duckduckgo/community-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/duckduckgo/community-platform/contents/{+path}","compare_url":"https://api.github.com/repos/duckduckgo/community-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/duckduckgo/community-platform/merges","archive_url":"https://api.github.com/repos/duckduckgo/community-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/duckduckgo/community-platform/downloads","issues_url":"https://api.github.com/repos/duckduckgo/community-platform/issues{/number}","pulls_url":"https://api.github.com/repos/duckduckgo/community-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/duckduckgo/community-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/duckduckgo/community-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/duckduckgo/community-platform/labels{/name}","releases_url":"https://api.github.com/repos/duckduckgo/community-platform/releases{/id}","deployments_url":"https://api.github.com/repos/duckduckgo/community-platform/deployments","created_at":"2011-05-15T17:35:41Z","updated_at":"2016-04-20T03:52:23Z","pushed_at":"2016-04-20T19:30:05Z","git_url":"git://github.com/duckduckgo/community-platform.git","ssh_url":"git@github.com:duckduckgo/community-platform.git","clone_url":"https://github.com/duckduckgo/community-platform.git","svn_url":"https://github.com/duckduckgo/community-platform","homepage":"https://duck.co/","size":28149,"stargazers_count":419,"watchers_count":419,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":117,"mirror_url":null,"open_issues_count":150,"forks":117,"open_issues":150,"watchers":419,"default_branch":"master"}},"base":{"label":"duckduckgo:master","ref":"master","sha":"df2a0ee5264b0d8877dcad51dcd88c9fe7946614","user":{"login":"duckduckgo","id":342708,"avatar_url":"https://avatars.githubusercontent.com/u/342708?v=3","gravatar_id":"","url":"https://api.github.com/users/duckduckgo","html_url":"https://github.com/duckduckgo","followers_url":"https://api.github.com/users/duckduckgo/followers","following_url":"https://api.github.com/users/duckduckgo/following{/other_user}","gists_url":"https://api.github.com/users/duckduckgo/gists{/gist_id}","starred_url":"https://api.github.com/users/duckduckgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duckduckgo/subscriptions","organizations_url":"https://api.github.com/users/duckduckgo/orgs","repos_url":"https://api.github.com/users/duckduckgo/repos","events_url":"https://api.github.com/users/duckduckgo/events{/privacy}","received_events_url":"https://api.github.com/users/duckduckgo/received_events","type":"Organization","site_admin":false},"repo":{"id":1751775,"name":"community-platform","full_name":"duckduckgo/community-platform","owner":{"login":"duckduckgo","id":342708,"avatar_url":"https://avatars.githubusercontent.com/u/342708?v=3","gravatar_id":"","url":"https://api.github.com/users/duckduckgo","html_url":"https://github.com/duckduckgo","followers_url":"https://api.github.com/users/duckduckgo/followers","following_url":"https://api.github.com/users/duckduckgo/following{/other_user}","gists_url":"https://api.github.com/users/duckduckgo/gists{/gist_id}","starred_url":"https://api.github.com/users/duckduckgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duckduckgo/subscriptions","organizations_url":"https://api.github.com/users/duckduckgo/orgs","repos_url":"https://api.github.com/users/duckduckgo/repos","events_url":"https://api.github.com/users/duckduckgo/events{/privacy}","received_events_url":"https://api.github.com/users/duckduckgo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/duckduckgo/community-platform","description":"DuckDuckGo Community Platform","fork":false,"url":"https://api.github.com/repos/duckduckgo/community-platform","forks_url":"https://api.github.com/repos/duckduckgo/community-platform/forks","keys_url":"https://api.github.com/repos/duckduckgo/community-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/duckduckgo/community-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/duckduckgo/community-platform/teams","hooks_url":"https://api.github.com/repos/duckduckgo/community-platform/hooks","issue_events_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/events{/number}","events_url":"https://api.github.com/repos/duckduckgo/community-platform/events","assignees_url":"https://api.github.com/repos/duckduckgo/community-platform/assignees{/user}","branches_url":"https://api.github.com/repos/duckduckgo/community-platform/branches{/branch}","tags_url":"https://api.github.com/repos/duckduckgo/community-platform/tags","blobs_url":"https://api.github.com/repos/duckduckgo/community-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/duckduckgo/community-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/duckduckgo/community-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/duckduckgo/community-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/duckduckgo/community-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/duckduckgo/community-platform/languages","stargazers_url":"https://api.github.com/repos/duckduckgo/community-platform/stargazers","contributors_url":"https://api.github.com/repos/duckduckgo/community-platform/contributors","subscribers_url":"https://api.github.com/repos/duckduckgo/community-platform/subscribers","subscription_url":"https://api.github.com/repos/duckduckgo/community-platform/subscription","commits_url":"https://api.github.com/repos/duckduckgo/community-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/duckduckgo/community-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/duckduckgo/community-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/duckduckgo/community-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/duckduckgo/community-platform/contents/{+path}","compare_url":"https://api.github.com/repos/duckduckgo/community-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/duckduckgo/community-platform/merges","archive_url":"https://api.github.com/repos/duckduckgo/community-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/duckduckgo/community-platform/downloads","issues_url":"https://api.github.com/repos/duckduckgo/community-platform/issues{/number}","pulls_url":"https://api.github.com/repos/duckduckgo/community-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/duckduckgo/community-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/duckduckgo/community-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/duckduckgo/community-platform/labels{/name}","releases_url":"https://api.github.com/repos/duckduckgo/community-platform/releases{/id}","deployments_url":"https://api.github.com/repos/duckduckgo/community-platform/deployments","created_at":"2011-05-15T17:35:41Z","updated_at":"2016-04-20T03:52:23Z","pushed_at":"2016-04-20T19:30:05Z","git_url":"git://github.com/duckduckgo/community-platform.git","ssh_url":"git@github.com:duckduckgo/community-platform.git","clone_url":"https://github.com/duckduckgo/community-platform.git","svn_url":"https://github.com/duckduckgo/community-platform","homepage":"https://duck.co/","size":28149,"stargazers_count":419,"watchers_count":419,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":117,"mirror_url":null,"open_issues_count":150,"forks":117,"open_issues":150,"watchers":419,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1326"},"html":{"href":"https://github.com/duckduckgo/community-platform/pull/1326"},"issue":{"href":"https://api.github.com/repos/duckduckgo/community-platform/issues/1326"},"comments":{"href":"https://api.github.com/repos/duckduckgo/community-platform/issues/1326/comments"},"review_comments":{"href":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1326/comments"},"review_comment":{"href":"https://api.github.com/repos/duckduckgo/community-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/duckduckgo/community-platform/pulls/1326/commits"},"statuses":{"href":"https://api.github.com/repos/duckduckgo/community-platform/statuses/01d067d6b7183b3cd962322f3895400644099cf8"}}}}