{"action":"created","comment":{"url":"https://api.github.com/repos/ppy/osu-web/pulls/comments/212509732","pull_request_review_id":149160431,"id":212509732,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjUwOTczMg==","diff_hunk":"@@ -23,34 +23,74 @@\n use App\\Models\\Beatmap;\n use App\\Models\\Country;\n use App\\Models\\CountryStatistics;\n+use App\\Models\\Spotlight;\n+use App\\Models\\User;\n use App\\Models\\UserStatistics;\n use Illuminate\\Pagination\\LengthAwarePaginator;\n-use Redirect;\n-use Request;\n \n class RankingController extends Controller\n {\n     protected $section = 'rankings';\n \n+    private $country;\n+\n     const PAGE_SIZE = 50;\n     const MAX_RESULTS = 10000;\n-    const RANKING_TYPES = ['performance', 'score', 'country'];\n+    const SPOTLIGHT_MAX_RESULTS = 40;\n+    const RANKING_TYPES = ['performance', 'monthly', 'charts', 'score', 'country'];\n+    const SPOTLIGHT_TYPES = ['charts', 'monthly'];\n \n-    public function index($mode = 'osu', $type = null)\n+    public function __construct()\n     {\n-        if (!array_key_exists($mode, Beatmap::MODES)) {\n-            abort(404);\n-        }\n+        parent::__construct();\n \n-        if ($type === null) {\n-            return ujs_redirect(route('rankings', ['mode' => $mode, 'type' => 'performance']));\n-        }\n+        $mode = request('mode');\n+        $type = request('type');\n \n-        if (!in_array($type, static::RANKING_TYPES, true)) {\n-            abort(404);\n+        view()->share('hasPager', !in_array(request('type'), static::SPOTLIGHT_TYPES, true));\n+        view()->share('currentAction', request('type'));\n+        view()->share('mode', $mode);\n+        view()->share('type', $type);\n+\n+        $this->middleware(function ($request, $next) use ($mode, $type) {\n+            if (!array_key_exists($mode, Beatmap::MODES)) {\n+                abort(404);\n+            }\n+\n+            if ($type === null) {\n+                return ujs_redirect(route('rankings', ['mode' => $mode, 'type' => 'performance']));\n+            }\n+\n+            if (!in_array($type, static::RANKING_TYPES, true)) {\n+                abort(404);\n+            }\n+\n+            if (request()->has('country') && !in_array($type, static::SPOTLIGHT_TYPES, true)) {\n+                $countryStats = CountryStatistics::where('display', 1)","path":"app/Http/Controllers/RankingController.php","position":60,"original_position":59,"commit_id":"29b484f5e6f150a2c4e04fe8bec05a0fa500a455","original_commit_id":"53184fdc2865ebb8f65c3f3d72705da4d9bfef0b","user":{"login":"notbakaneko","id":1694544,"node_id":"MDQ6VXNlcjE2OTQ1NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1694544?v=4","gravatar_id":"","url":"https://api.github.com/users/notbakaneko","html_url":"https://github.com/notbakaneko","followers_url":"https://api.github.com/users/notbakaneko/followers","following_url":"https://api.github.com/users/notbakaneko/following{/other_user}","gists_url":"https://api.github.com/users/notbakaneko/gists{/gist_id}","starred_url":"https://api.github.com/users/notbakaneko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notbakaneko/subscriptions","organizations_url":"https://api.github.com/users/notbakaneko/orgs","repos_url":"https://api.github.com/users/notbakaneko/repos","events_url":"https://api.github.com/users/notbakaneko/events{/privacy}","received_events_url":"https://api.github.com/users/notbakaneko/received_events","type":"User","site_admin":false},"body":"not very relevant to the PR","created_at":"2018-08-24T02:51:57Z","updated_at":"2018-08-24T02:51:57Z","html_url":"https://github.com/ppy/osu-web/pull/3519#discussion_r212509732","pull_request_url":"https://api.github.com/repos/ppy/osu-web/pulls/3519","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/comments/212509732"},"html":{"href":"https://github.com/ppy/osu-web/pull/3519#discussion_r212509732"},"pull_request":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/3519"}},"in_reply_to_id":210565271},"pull_request":{"url":"https://api.github.com/repos/ppy/osu-web/pulls/3519","id":203763234,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzNzYzMjM0","html_url":"https://github.com/ppy/osu-web/pull/3519","diff_url":"https://github.com/ppy/osu-web/pull/3519.diff","patch_url":"https://github.com/ppy/osu-web/pull/3519.patch","issue_url":"https://api.github.com/repos/ppy/osu-web/issues/3519","number":3519,"state":"open","locked":false,"title":"Add spotlight rankings","user":{"login":"notbakaneko","id":1694544,"node_id":"MDQ6VXNlcjE2OTQ1NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1694544?v=4","gravatar_id":"","url":"https://api.github.com/users/notbakaneko","html_url":"https://github.com/notbakaneko","followers_url":"https://api.github.com/users/notbakaneko/followers","following_url":"https://api.github.com/users/notbakaneko/following{/other_user}","gists_url":"https://api.github.com/users/notbakaneko/gists{/gist_id}","starred_url":"https://api.github.com/users/notbakaneko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notbakaneko/subscriptions","organizations_url":"https://api.github.com/users/notbakaneko/orgs","repos_url":"https://api.github.com/users/notbakaneko/repos","events_url":"https://api.github.com/users/notbakaneko/events{/privacy}","received_events_url":"https://api.github.com/users/notbakaneko/received_events","type":"User","site_admin":false},"body":"- add spotlight (`chart`) rankings\r\n- some `RankingController` reorganization\r\n\r\nfixes #1169\r\n\r\n---\r\n","created_at":"2018-07-25T08:44:47Z","updated_at":"2018-08-24T02:51:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3fda1570a5d25918976f401a9d1f00882490f371","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ppy/osu-web/pulls/3519/commits","review_comments_url":"https://api.github.com/repos/ppy/osu-web/pulls/3519/comments","review_comment_url":"https://api.github.com/repos/ppy/osu-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ppy/osu-web/issues/3519/comments","statuses_url":"https://api.github.com/repos/ppy/osu-web/statuses/29b484f5e6f150a2c4e04fe8bec05a0fa500a455","head":{"label":"notbakaneko:feature/spotlight-rankings","ref":"feature/spotlight-rankings","sha":"29b484f5e6f150a2c4e04fe8bec05a0fa500a455","user":{"login":"notbakaneko","id":1694544,"node_id":"MDQ6VXNlcjE2OTQ1NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1694544?v=4","gravatar_id":"","url":"https://api.github.com/users/notbakaneko","html_url":"https://github.com/notbakaneko","followers_url":"https://api.github.com/users/notbakaneko/followers","following_url":"https://api.github.com/users/notbakaneko/following{/other_user}","gists_url":"https://api.github.com/users/notbakaneko/gists{/gist_id}","starred_url":"https://api.github.com/users/notbakaneko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notbakaneko/subscriptions","organizations_url":"https://api.github.com/users/notbakaneko/orgs","repos_url":"https://api.github.com/users/notbakaneko/repos","events_url":"https://api.github.com/users/notbakaneko/events{/privacy}","received_events_url":"https://api.github.com/users/notbakaneko/received_events","type":"User","site_admin":false},"repo":{"id":89994768,"node_id":"MDEwOlJlcG9zaXRvcnk4OTk5NDc2OA==","name":"osu-web","full_name":"notbakaneko/osu-web","owner":{"login":"notbakaneko","id":1694544,"node_id":"MDQ6VXNlcjE2OTQ1NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1694544?v=4","gravatar_id":"","url":"https://api.github.com/users/notbakaneko","html_url":"https://github.com/notbakaneko","followers_url":"https://api.github.com/users/notbakaneko/followers","following_url":"https://api.github.com/users/notbakaneko/following{/other_user}","gists_url":"https://api.github.com/users/notbakaneko/gists{/gist_id}","starred_url":"https://api.github.com/users/notbakaneko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notbakaneko/subscriptions","organizations_url":"https://api.github.com/users/notbakaneko/orgs","repos_url":"https://api.github.com/users/notbakaneko/repos","events_url":"https://api.github.com/users/notbakaneko/events{/privacy}","received_events_url":"https://api.github.com/users/notbakaneko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/notbakaneko/osu-web","description":"the future face of osu!","fork":true,"url":"https://api.github.com/repos/notbakaneko/osu-web","forks_url":"https://api.github.com/repos/notbakaneko/osu-web/forks","keys_url":"https://api.github.com/repos/notbakaneko/osu-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/notbakaneko/osu-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/notbakaneko/osu-web/teams","hooks_url":"https://api.github.com/repos/notbakaneko/osu-web/hooks","issue_events_url":"https://api.github.com/repos/notbakaneko/osu-web/issues/events{/number}","events_url":"https://api.github.com/repos/notbakaneko/osu-web/events","assignees_url":"https://api.github.com/repos/notbakaneko/osu-web/assignees{/user}","branches_url":"https://api.github.com/repos/notbakaneko/osu-web/branches{/branch}","tags_url":"https://api.github.com/repos/notbakaneko/osu-web/tags","blobs_url":"https://api.github.com/repos/notbakaneko/osu-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/notbakaneko/osu-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/notbakaneko/osu-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/notbakaneko/osu-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/notbakaneko/osu-web/statuses/{sha}","languages_url":"https://api.github.com/repos/notbakaneko/osu-web/languages","stargazers_url":"https://api.github.com/repos/notbakaneko/osu-web/stargazers","contributors_url":"https://api.github.com/repos/notbakaneko/osu-web/contributors","subscribers_url":"https://api.github.com/repos/notbakaneko/osu-web/subscribers","subscription_url":"https://api.github.com/repos/notbakaneko/osu-web/subscription","commits_url":"https://api.github.com/repos/notbakaneko/osu-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/notbakaneko/osu-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/notbakaneko/osu-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/notbakaneko/osu-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/notbakaneko/osu-web/contents/{+path}","compare_url":"https://api.github.com/repos/notbakaneko/osu-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/notbakaneko/osu-web/merges","archive_url":"https://api.github.com/repos/notbakaneko/osu-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/notbakaneko/osu-web/downloads","issues_url":"https://api.github.com/repos/notbakaneko/osu-web/issues{/number}","pulls_url":"https://api.github.com/repos/notbakaneko/osu-web/pulls{/number}","milestones_url":"https://api.github.com/repos/notbakaneko/osu-web/milestones{/number}","notifications_url":"https://api.github.com/repos/notbakaneko/osu-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/notbakaneko/osu-web/labels{/name}","releases_url":"https://api.github.com/repos/notbakaneko/osu-web/releases{/id}","deployments_url":"https://api.github.com/repos/notbakaneko/osu-web/deployments","created_at":"2017-05-02T05:26:16Z","updated_at":"2018-08-23T09:40:43Z","pushed_at":"2018-08-23T09:40:42Z","git_url":"git://github.com/notbakaneko/osu-web.git","ssh_url":"git@github.com:notbakaneko/osu-web.git","clone_url":"https://github.com/notbakaneko/osu-web.git","svn_url":"https://github.com/notbakaneko/osu-web","homepage":null,"size":53305,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ppy:master","ref":"master","sha":"964d87e150fd48559bcae11cded21a8dfd7118e4","user":{"login":"ppy","id":995763,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NTc2Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/995763?v=4","gravatar_id":"","url":"https://api.github.com/users/ppy","html_url":"https://github.com/ppy","followers_url":"https://api.github.com/users/ppy/followers","following_url":"https://api.github.com/users/ppy/following{/other_user}","gists_url":"https://api.github.com/users/ppy/gists{/gist_id}","starred_url":"https://api.github.com/users/ppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppy/subscriptions","organizations_url":"https://api.github.com/users/ppy/orgs","repos_url":"https://api.github.com/users/ppy/repos","events_url":"https://api.github.com/users/ppy/events{/privacy}","received_events_url":"https://api.github.com/users/ppy/received_events","type":"Organization","site_admin":false},"repo":{"id":41410580,"node_id":"MDEwOlJlcG9zaXRvcnk0MTQxMDU4MA==","name":"osu-web","full_name":"ppy/osu-web","owner":{"login":"ppy","id":995763,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NTc2Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/995763?v=4","gravatar_id":"","url":"https://api.github.com/users/ppy","html_url":"https://github.com/ppy","followers_url":"https://api.github.com/users/ppy/followers","following_url":"https://api.github.com/users/ppy/following{/other_user}","gists_url":"https://api.github.com/users/ppy/gists{/gist_id}","starred_url":"https://api.github.com/users/ppy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppy/subscriptions","organizations_url":"https://api.github.com/users/ppy/orgs","repos_url":"https://api.github.com/users/ppy/repos","events_url":"https://api.github.com/users/ppy/events{/privacy}","received_events_url":"https://api.github.com/users/ppy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ppy/osu-web","description":"the browser-facing portion of osu!","fork":false,"url":"https://api.github.com/repos/ppy/osu-web","forks_url":"https://api.github.com/repos/ppy/osu-web/forks","keys_url":"https://api.github.com/repos/ppy/osu-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ppy/osu-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ppy/osu-web/teams","hooks_url":"https://api.github.com/repos/ppy/osu-web/hooks","issue_events_url":"https://api.github.com/repos/ppy/osu-web/issues/events{/number}","events_url":"https://api.github.com/repos/ppy/osu-web/events","assignees_url":"https://api.github.com/repos/ppy/osu-web/assignees{/user}","branches_url":"https://api.github.com/repos/ppy/osu-web/branches{/branch}","tags_url":"https://api.github.com/repos/ppy/osu-web/tags","blobs_url":"https://api.github.com/repos/ppy/osu-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ppy/osu-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ppy/osu-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/ppy/osu-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ppy/osu-web/statuses/{sha}","languages_url":"https://api.github.com/repos/ppy/osu-web/languages","stargazers_url":"https://api.github.com/repos/ppy/osu-web/stargazers","contributors_url":"https://api.github.com/repos/ppy/osu-web/contributors","subscribers_url":"https://api.github.com/repos/ppy/osu-web/subscribers","subscription_url":"https://api.github.com/repos/ppy/osu-web/subscription","commits_url":"https://api.github.com/repos/ppy/osu-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/ppy/osu-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/ppy/osu-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/ppy/osu-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/ppy/osu-web/contents/{+path}","compare_url":"https://api.github.com/repos/ppy/osu-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ppy/osu-web/merges","archive_url":"https://api.github.com/repos/ppy/osu-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ppy/osu-web/downloads","issues_url":"https://api.github.com/repos/ppy/osu-web/issues{/number}","pulls_url":"https://api.github.com/repos/ppy/osu-web/pulls{/number}","milestones_url":"https://api.github.com/repos/ppy/osu-web/milestones{/number}","notifications_url":"https://api.github.com/repos/ppy/osu-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ppy/osu-web/labels{/name}","releases_url":"https://api.github.com/repos/ppy/osu-web/releases{/id}","deployments_url":"https://api.github.com/repos/ppy/osu-web/deployments","created_at":"2015-08-26T07:14:32Z","updated_at":"2018-08-23T04:25:37Z","pushed_at":"2018-08-23T13:58:44Z","git_url":"git://github.com/ppy/osu-web.git","ssh_url":"git@github.com:ppy/osu-web.git","clone_url":"https://github.com/ppy/osu-web.git","svn_url":"https://github.com/ppy/osu-web","homepage":"https://osu.ppy.sh","size":52693,"stargazers_count":381,"watchers_count":381,"language":"PHP","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":221,"mirror_url":null,"archived":false,"open_issues_count":370,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":221,"open_issues":370,"watchers":381,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/3519"},"html":{"href":"https://github.com/ppy/osu-web/pull/3519"},"issue":{"href":"https://api.github.com/repos/ppy/osu-web/issues/3519"},"comments":{"href":"https://api.github.com/repos/ppy/osu-web/issues/3519/comments"},"review_comments":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/3519/comments"},"review_comment":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/3519/commits"},"statuses":{"href":"https://api.github.com/repos/ppy/osu-web/statuses/29b484f5e6f150a2c4e04fe8bec05a0fa500a455"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"notbakaneko"}}