{"action":"created","comment":{"url":"https://api.github.com/repos/pattisdr/osf.io/pulls/comments/52942467","id":52942467,"diff_hunk":"@@ -0,0 +1,140 @@\n+\"\"\"\n+This will update node links on POPULAR_LINKS_NODE and NEW_AND_NOTEWORTHY_LINKS_NODE.\n+\"\"\"\n+import sys\n+import logging\n+import datetime\n+import dateutil\n+import operator\n+import requests\n+from modularodm import Q\n+from website.app import init_app\n+from website import models\n+from framework.auth.core import Auth\n+from scripts import utils as script_utils\n+from framework.transactions.context import TokuTransaction\n+from website.settings.defaults import POPULAR_LINKS_NODE, NEW_AND_NOTEWORTHY_LINKS_NODE","path":"scripts/populate-popular-and-new-and-noteworthy-projects.py","position":16,"original_position":16,"commit_id":"21a0298131884ba3c1e31bb6e656572ecd130f00","original_commit_id":"21a0298131884ba3c1e31bb6e656572ecd130f00","user":{"login":"whit537","id":134455,"avatar_url":"https://avatars.githubusercontent.com/u/134455?v=3","gravatar_id":"","url":"https://api.github.com/users/whit537","html_url":"https://github.com/whit537","followers_url":"https://api.github.com/users/whit537/followers","following_url":"https://api.github.com/users/whit537/following{/other_user}","gists_url":"https://api.github.com/users/whit537/gists{/gist_id}","starred_url":"https://api.github.com/users/whit537/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whit537/subscriptions","organizations_url":"https://api.github.com/users/whit537/orgs","repos_url":"https://api.github.com/users/whit537/repos","events_url":"https://api.github.com/users/whit537/events{/privacy}","received_events_url":"https://api.github.com/users/whit537/received_events","type":"User","site_admin":false},"body":"Ooooh! This is interesting! We may indeed have some automatic layering of `website.settings.local` values into `website.settings.default`, because I believe I'm seeing that if I set `POPULAR_LINKS_NODE` in `website.settings.local`, that is what gets hit from the client.","created_at":"2016-02-15T20:54:03Z","updated_at":"2016-02-15T20:54:03Z","html_url":"https://github.com/pattisdr/osf.io/pull/2#discussion_r52942467","pull_request_url":"https://api.github.com/repos/pattisdr/osf.io/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/comments/52942467"},"html":{"href":"https://github.com/pattisdr/osf.io/pull/2#discussion_r52942467"},"pull_request":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/pattisdr/osf.io/pulls/2","id":57022580,"html_url":"https://github.com/pattisdr/osf.io/pull/2","diff_url":"https://github.com/pattisdr/osf.io/pull/2.diff","patch_url":"https://github.com/pattisdr/osf.io/pull/2.patch","issue_url":"https://api.github.com/repos/pattisdr/osf.io/issues/2","number":2,"state":"open","locked":false,"title":"[Ready to Review] New/Noteworthy and Most Popular Projects","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"body":"# Purpose\r\n\r\n** I made the PR to my own branch for now until Quick Search gets merged in.\r\n\r\nSolves issues  https://openscience.atlassian.net/browse/OSF-5386 and https://openscience.atlassian.net/browse/OSF-5473\r\n\r\nInherits from Quick Search Projects https://github.com/caneruguz/osf.io/pull/17\r\n\r\nDisplays two columns of projects: New and Noteworthy and Most Popular.  Both columns of projects are populated by a script (populate-popular-and-new-and-noteworthy-projects.py) which adds the relevant node links to POPULAR_LINKS_NODE and the NEW_AND_NOTEWORTHY_LINKS_NODE.  Popular links will be the same nodes as https://osf.io/explore/activity/#popularPublicProjects.  New/noteworthy nodes pull out the last month of public projects and sorts by highest log activity.  Both popular nodes and new/noteworthy nodes are stored as node links on popular_links_node and new_and_noteworthy_links_node, nodes that will need to be defined in production.  This script can be run daily.\r\n\r\nCurrently popular nodes are calculated every time someone visits the page, which is unnecessary.\r\n\r\n# Changes\r\n\r\nNew dashboard change\r\n- New/noteworthy and popular nodes display the title, description, and contributors.\r\n- Title/description/contributors are restricted to one line...if too long, ellipsis displayed.  Tooltips display full text on hover.\r\n- If >3 contributors, formatting is: Pattison, Pattison, and Pattison + 23\r\n- Button for finding more projects w/ advanced search\r\n- Plugin for hosting a conference/meeting - links all currently go to the same place - Caner is going to change this later.\r\n\r\n### My implementation:\r\n![screen shot 2016-01-24 at 9 03 11 pm](https://cloud.githubusercontent.com/assets/9755598/12540960/00703ff4-c2de-11e5-9549-a4715db405f5.png)\r\n\r\n### Wireframe\r\n![screen shot 2016-01-24 at 9 05 01 pm](https://cloud.githubusercontent.com/assets/9755598/12540980/30139da0-c2de-11e5-9d21-24a2cc77dce3.png)\r\n\r\n# For reviewers\r\n\r\n### Steps to populate New and Noteworthy Nodes and Most Popular Nodes locally\r\n\r\nNew/Noteworthy Nodes and Most Popular Nodes are nodes that are stored as node links under POPULAR_LINKS_NODE and NEW_AND_NOTEWORTHY_LINK_NODE in website/settings/defaults. https://github.com/pattisdr/osf.io/pull/2/files#diff-e617d08b11daf61c1b3ca71efb807195R231.  Set POPULAR_LINKS_NODE and NEW_AND_NOTEWORTHY_LINKS node as two nodes that you have locally.  \r\n\r\n<s> Then go to https://github.com/pattisdr/osf.io/pull/2/files#diff-cde0306aa5de57870f544a7b1c412affR90 and change the popular_nodes to five other nodes that you have defined locally.  Then run the script, populate-popular-and-new-and-noteworthy-projects.py. </s>\r\nNo longer applicable.  Add five node links each to POPULAR_LINKS_NODE and NEW_AND_NOTEWORTHY_LINKS_NODE (`/v2/nodes/{node_id}/node_links/`}\r\n\r\nIn production, POPULAR_LINKS_NODE and NEW_AND_NOTEWORTHY_LINKS_NODE will be defined, and popular_nodes will not need to be manually populated.  The script can be run once a day to populate the POPULAR and NEW/NOTEWORTHY links node with node links to the most popular and new/noteworthy projects.","created_at":"2016-01-25T02:20:26Z","updated_at":"2016-02-15T20:54:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"982baca187c2eaaaeebf6d567109cbfacaa9c29b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pattisdr/osf.io/pulls/2/commits","review_comments_url":"https://api.github.com/repos/pattisdr/osf.io/pulls/2/comments","review_comment_url":"https://api.github.com/repos/pattisdr/osf.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pattisdr/osf.io/issues/2/comments","statuses_url":"https://api.github.com/repos/pattisdr/osf.io/statuses/21a0298131884ba3c1e31bb6e656572ecd130f00","head":{"label":"pattisdr:newAndNoteworthy","ref":"newAndNoteworthy","sha":"21a0298131884ba3c1e31bb6e656572ecd130f00","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"repo":{"id":35900874,"name":"osf.io","full_name":"pattisdr/osf.io","owner":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pattisdr/osf.io","description":"Facilitating Open Science","fork":true,"url":"https://api.github.com/repos/pattisdr/osf.io","forks_url":"https://api.github.com/repos/pattisdr/osf.io/forks","keys_url":"https://api.github.com/repos/pattisdr/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pattisdr/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pattisdr/osf.io/teams","hooks_url":"https://api.github.com/repos/pattisdr/osf.io/hooks","issue_events_url":"https://api.github.com/repos/pattisdr/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/pattisdr/osf.io/events","assignees_url":"https://api.github.com/repos/pattisdr/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/pattisdr/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/pattisdr/osf.io/tags","blobs_url":"https://api.github.com/repos/pattisdr/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pattisdr/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pattisdr/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/pattisdr/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pattisdr/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/pattisdr/osf.io/languages","stargazers_url":"https://api.github.com/repos/pattisdr/osf.io/stargazers","contributors_url":"https://api.github.com/repos/pattisdr/osf.io/contributors","subscribers_url":"https://api.github.com/repos/pattisdr/osf.io/subscribers","subscription_url":"https://api.github.com/repos/pattisdr/osf.io/subscription","commits_url":"https://api.github.com/repos/pattisdr/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/pattisdr/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/pattisdr/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/pattisdr/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/pattisdr/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/pattisdr/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pattisdr/osf.io/merges","archive_url":"https://api.github.com/repos/pattisdr/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pattisdr/osf.io/downloads","issues_url":"https://api.github.com/repos/pattisdr/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/pattisdr/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/pattisdr/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/pattisdr/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pattisdr/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/pattisdr/osf.io/releases{/id}","deployments_url":"https://api.github.com/repos/pattisdr/osf.io/deployments","created_at":"2015-05-19T18:33:09Z","updated_at":"2016-01-11T21:17:43Z","pushed_at":"2016-02-12T21:16:37Z","git_url":"git://github.com/pattisdr/osf.io.git","ssh_url":"git@github.com:pattisdr/osf.io.git","clone_url":"https://github.com/pattisdr/osf.io.git","svn_url":"https://github.com/pattisdr/osf.io","homepage":"http://osf.io","size":121643,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"pattisdr:quickSearchProjects","ref":"quickSearchProjects","sha":"8c1a898606a867fdcc6f41bf6ec6f8fb7a69ea53","user":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"repo":{"id":35900874,"name":"osf.io","full_name":"pattisdr/osf.io","owner":{"login":"pattisdr","id":9755598,"avatar_url":"https://avatars.githubusercontent.com/u/9755598?v=3","gravatar_id":"","url":"https://api.github.com/users/pattisdr","html_url":"https://github.com/pattisdr","followers_url":"https://api.github.com/users/pattisdr/followers","following_url":"https://api.github.com/users/pattisdr/following{/other_user}","gists_url":"https://api.github.com/users/pattisdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pattisdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pattisdr/subscriptions","organizations_url":"https://api.github.com/users/pattisdr/orgs","repos_url":"https://api.github.com/users/pattisdr/repos","events_url":"https://api.github.com/users/pattisdr/events{/privacy}","received_events_url":"https://api.github.com/users/pattisdr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pattisdr/osf.io","description":"Facilitating Open Science","fork":true,"url":"https://api.github.com/repos/pattisdr/osf.io","forks_url":"https://api.github.com/repos/pattisdr/osf.io/forks","keys_url":"https://api.github.com/repos/pattisdr/osf.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pattisdr/osf.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pattisdr/osf.io/teams","hooks_url":"https://api.github.com/repos/pattisdr/osf.io/hooks","issue_events_url":"https://api.github.com/repos/pattisdr/osf.io/issues/events{/number}","events_url":"https://api.github.com/repos/pattisdr/osf.io/events","assignees_url":"https://api.github.com/repos/pattisdr/osf.io/assignees{/user}","branches_url":"https://api.github.com/repos/pattisdr/osf.io/branches{/branch}","tags_url":"https://api.github.com/repos/pattisdr/osf.io/tags","blobs_url":"https://api.github.com/repos/pattisdr/osf.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pattisdr/osf.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pattisdr/osf.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/pattisdr/osf.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pattisdr/osf.io/statuses/{sha}","languages_url":"https://api.github.com/repos/pattisdr/osf.io/languages","stargazers_url":"https://api.github.com/repos/pattisdr/osf.io/stargazers","contributors_url":"https://api.github.com/repos/pattisdr/osf.io/contributors","subscribers_url":"https://api.github.com/repos/pattisdr/osf.io/subscribers","subscription_url":"https://api.github.com/repos/pattisdr/osf.io/subscription","commits_url":"https://api.github.com/repos/pattisdr/osf.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/pattisdr/osf.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/pattisdr/osf.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/pattisdr/osf.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/pattisdr/osf.io/contents/{+path}","compare_url":"https://api.github.com/repos/pattisdr/osf.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pattisdr/osf.io/merges","archive_url":"https://api.github.com/repos/pattisdr/osf.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pattisdr/osf.io/downloads","issues_url":"https://api.github.com/repos/pattisdr/osf.io/issues{/number}","pulls_url":"https://api.github.com/repos/pattisdr/osf.io/pulls{/number}","milestones_url":"https://api.github.com/repos/pattisdr/osf.io/milestones{/number}","notifications_url":"https://api.github.com/repos/pattisdr/osf.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pattisdr/osf.io/labels{/name}","releases_url":"https://api.github.com/repos/pattisdr/osf.io/releases{/id}","deployments_url":"https://api.github.com/repos/pattisdr/osf.io/deployments","created_at":"2015-05-19T18:33:09Z","updated_at":"2016-01-11T21:17:43Z","pushed_at":"2016-02-12T21:16:37Z","git_url":"git://github.com/pattisdr/osf.io.git","ssh_url":"git@github.com:pattisdr/osf.io.git","clone_url":"https://github.com/pattisdr/osf.io.git","svn_url":"https://github.com/pattisdr/osf.io","homepage":"http://osf.io","size":121643,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/2"},"html":{"href":"https://github.com/pattisdr/osf.io/pull/2"},"issue":{"href":"https://api.github.com/repos/pattisdr/osf.io/issues/2"},"comments":{"href":"https://api.github.com/repos/pattisdr/osf.io/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pattisdr/osf.io/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/pattisdr/osf.io/statuses/21a0298131884ba3c1e31bb6e656572ecd130f00"}}}}