{"action":"created","comment":{"url":"https://api.github.com/repos/ppy/osu-web/pulls/comments/53607826","id":53607826,"diff_hunk":"@@ -0,0 +1,350 @@\n+<?php\n+\n+use Illuminate\\Database\\Seeder;\n+\n+class UserBeatmapSeeder extends Seeder\n+{\n+    /**\n+     * Run the database seeds.\n+     *\n+     * @return void\n+     */\n+    public function run()\n+    {\n+        try {\n+            DB::table('phpbb_user_group')->delete();\n+            DB::table('osu_scores')->delete();\n+            DB::table('osu_scores_high')->delete();\n+\n+            DB::table('phpbb_users')->delete();\n+\n+            $datapath = base_path().'/database/data/json/';\n+        // USERS\n+\n+        // Store saved / overwritten data in arrays\n+        $savedusers = [];\n+            $overusers = [];\n+            $overstats = [];\n+            $overhist = [];\n+            $overscores = [];\n+            $overevents = [];\n+            $savedbeatmaps = [];\n+            $savedscores = [];\n+            $overbeatmaps = [];\n+            $savedbeatmapsets = [];\n+            $overbeatmapsets = [];\n+            $error_log = [];\n+            $exceptions = [];\n+            $saveduserids = [];\n+\n+            $users = json_decode(file_get_contents($datapath.'users.json'));","path":"database/seeds/UserBeatmapSeeder.php","position":40,"original_position":40,"commit_id":"e2a42c948b997907e116f2f9b16c211f98b09c34","original_commit_id":"e2a42c948b997907e116f2f9b16c211f98b09c34","user":{"login":"LiquidPL","id":991831,"avatar_url":"https://avatars.githubusercontent.com/u/991831?v=3","gravatar_id":"","url":"https://api.github.com/users/LiquidPL","html_url":"https://github.com/LiquidPL","followers_url":"https://api.github.com/users/LiquidPL/followers","following_url":"https://api.github.com/users/LiquidPL/following{/other_user}","gists_url":"https://api.github.com/users/LiquidPL/gists{/gist_id}","starred_url":"https://api.github.com/users/LiquidPL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LiquidPL/subscriptions","organizations_url":"https://api.github.com/users/LiquidPL/orgs","repos_url":"https://api.github.com/users/LiquidPL/repos","events_url":"https://api.github.com/users/LiquidPL/events{/privacy}","received_events_url":"https://api.github.com/users/LiquidPL/received_events","type":"User","site_admin":false},"body":"You moved user generating from the model factory to a seeder, but you forgot to change the tests appropriately.\r\n\r\nAlso, shouldn't we have a model factory to generate random clean users for unit testing? Picking an user from database at random seems unreliable.","created_at":"2016-02-22T10:32:18Z","updated_at":"2016-02-22T10:32:18Z","html_url":"https://github.com/ppy/osu-web/pull/392#discussion_r53607826","pull_request_url":"https://api.github.com/repos/ppy/osu-web/pulls/392","_links":{"self":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/comments/53607826"},"html":{"href":"https://github.com/ppy/osu-web/pull/392#discussion_r53607826"},"pull_request":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/392"}}},"pull_request":{"url":"https://api.github.com/repos/ppy/osu-web/pulls/392","id":60056374,"html_url":"https://github.com/ppy/osu-web/pull/392","diff_url":"https://github.com/ppy/osu-web/pull/392.diff","patch_url":"https://github.com/ppy/osu-web/pull/392.patch","issue_url":"https://api.github.com/repos/ppy/osu-web/issues/392","number":392,"state":"open","locked":false,"title":"Add Seeders for Users/Stats/Beatmaps/Forum/Misc data #20, #391","user":{"login":"Hughp135","id":12624925,"avatar_url":"https://avatars.githubusercontent.com/u/12624925?v=3","gravatar_id":"","url":"https://api.github.com/users/Hughp135","html_url":"https://github.com/Hughp135","followers_url":"https://api.github.com/users/Hughp135/followers","following_url":"https://api.github.com/users/Hughp135/following{/other_user}","gists_url":"https://api.github.com/users/Hughp135/gists{/gist_id}","starred_url":"https://api.github.com/users/Hughp135/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hughp135/subscriptions","organizations_url":"https://api.github.com/users/Hughp135/orgs","repos_url":"https://api.github.com/users/Hughp135/repos","events_url":"https://api.github.com/users/Hughp135/events{/privacy}","received_events_url":"https://api.github.com/users/Hughp135/received_events","type":"User","site_admin":false},"body":"This is my first pull request on this repository so please forgive me for missing any conventions... Willing to make edits to code as necessary so it complies with the conventions.\r\n\r\nAdded a seeder. See comment at https://github.com/ppy/osu-web/issues/20#issuecomment-186359003 for details.\r\n\r\nNote: this deletes most tables before reseeding so be aware of that if you want to run it with php artisan db:seed, to back up your db if you have your own data in there.\r\n\r\nSummary of changes:\r\n\r\n- Tables that are seeded: phpbb_users, phpbb_user_stats, osu_beatmaps, osu_beatmapsets, osu_events, osu_leaders, osu_scores, osu_scores_high,  phpbb_forums, phpbb_topics, phpbb_posts, osu_user_beatmap_playcount, osu_favouritemaps\r\n\r\n- A few model changes that were necessary for the seeder (and possibly in general)\r\n\r\n- Added more statements to the sql dumps, as those fields were required. Note: most of the sql file changes are also made in pull request https://github.com/ppy/osu-web/pull/359\r\n\r\n- Added \"php artisan db:seed\" command to build.sh.\r\n\r\n- Added /database/data/json/ to .gitignore\r\n\r\n- Seeder makes a log file of all data imported from the jsons (in /database/data/json/log.txt)\r\n\r\n- The password for every user is 'password' and they are all admins\r\n\r\n\r\nThings left to seed: Everything osu-store related, Stats for game modes other than standard\r\n\r\n\r\nP.S. if anyone's interested in seeing how I used data obtained from the osu API to generate jsons/zip files, check out https://gist.github.com/Hughp135/8386cde4fb0e196f85b7","created_at":"2016-02-20T18:43:40Z","updated_at":"2016-02-22T10:32:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1341beab5c6e125ed94fc44cf71fd3027cd3d0a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ppy/osu-web/pulls/392/commits","review_comments_url":"https://api.github.com/repos/ppy/osu-web/pulls/392/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/392/comments","statuses_url":"https://api.github.com/repos/ppy/osu-web/statuses/e2a42c948b997907e116f2f9b16c211f98b09c34","head":{"label":"Hughp135:hugh-seeder","ref":"hugh-seeder","sha":"e2a42c948b997907e116f2f9b16c211f98b09c34","user":{"login":"Hughp135","id":12624925,"avatar_url":"https://avatars.githubusercontent.com/u/12624925?v=3","gravatar_id":"","url":"https://api.github.com/users/Hughp135","html_url":"https://github.com/Hughp135","followers_url":"https://api.github.com/users/Hughp135/followers","following_url":"https://api.github.com/users/Hughp135/following{/other_user}","gists_url":"https://api.github.com/users/Hughp135/gists{/gist_id}","starred_url":"https://api.github.com/users/Hughp135/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hughp135/subscriptions","organizations_url":"https://api.github.com/users/Hughp135/orgs","repos_url":"https://api.github.com/users/Hughp135/repos","events_url":"https://api.github.com/users/Hughp135/events{/privacy}","received_events_url":"https://api.github.com/users/Hughp135/received_events","type":"User","site_admin":false},"repo":{"id":51937681,"name":"osu-web","full_name":"Hughp135/osu-web","owner":{"login":"Hughp135","id":12624925,"avatar_url":"https://avatars.githubusercontent.com/u/12624925?v=3","gravatar_id":"","url":"https://api.github.com/users/Hughp135","html_url":"https://github.com/Hughp135","followers_url":"https://api.github.com/users/Hughp135/followers","following_url":"https://api.github.com/users/Hughp135/following{/other_user}","gists_url":"https://api.github.com/users/Hughp135/gists{/gist_id}","starred_url":"https://api.github.com/users/Hughp135/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hughp135/subscriptions","organizations_url":"https://api.github.com/users/Hughp135/orgs","repos_url":"https://api.github.com/users/Hughp135/repos","events_url":"https://api.github.com/users/Hughp135/events{/privacy}","received_events_url":"https://api.github.com/users/Hughp135/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Hughp135/osu-web","description":"the future face of osu!","fork":true,"url":"https://api.github.com/repos/Hughp135/osu-web","forks_url":"https://api.github.com/repos/Hughp135/osu-web/forks","keys_url":"https://api.github.com/repos/Hughp135/osu-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hughp135/osu-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hughp135/osu-web/teams","hooks_url":"https://api.github.com/repos/Hughp135/osu-web/hooks","issue_events_url":"https://api.github.com/repos/Hughp135/osu-web/issues/events{/number}","events_url":"https://api.github.com/repos/Hughp135/osu-web/events","assignees_url":"https://api.github.com/repos/Hughp135/osu-web/assignees{/user}","branches_url":"https://api.github.com/repos/Hughp135/osu-web/branches{/branch}","tags_url":"https://api.github.com/repos/Hughp135/osu-web/tags","blobs_url":"https://api.github.com/repos/Hughp135/osu-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hughp135/osu-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hughp135/osu-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hughp135/osu-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hughp135/osu-web/statuses/{sha}","languages_url":"https://api.github.com/repos/Hughp135/osu-web/languages","stargazers_url":"https://api.github.com/repos/Hughp135/osu-web/stargazers","contributors_url":"https://api.github.com/repos/Hughp135/osu-web/contributors","subscribers_url":"https://api.github.com/repos/Hughp135/osu-web/subscribers","subscription_url":"https://api.github.com/repos/Hughp135/osu-web/subscription","commits_url":"https://api.github.com/repos/Hughp135/osu-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hughp135/osu-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hughp135/osu-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hughp135/osu-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hughp135/osu-web/contents/{+path}","compare_url":"https://api.github.com/repos/Hughp135/osu-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hughp135/osu-web/merges","archive_url":"https://api.github.com/repos/Hughp135/osu-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hughp135/osu-web/downloads","issues_url":"https://api.github.com/repos/Hughp135/osu-web/issues{/number}","pulls_url":"https://api.github.com/repos/Hughp135/osu-web/pulls{/number}","milestones_url":"https://api.github.com/repos/Hughp135/osu-web/milestones{/number}","notifications_url":"https://api.github.com/repos/Hughp135/osu-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hughp135/osu-web/labels{/name}","releases_url":"https://api.github.com/repos/Hughp135/osu-web/releases{/id}","deployments_url":"https://api.github.com/repos/Hughp135/osu-web/deployments","created_at":"2016-02-17T16:35:46Z","updated_at":"2016-02-17T16:35:48Z","pushed_at":"2016-02-21T15:38:35Z","git_url":"git://github.com/Hughp135/osu-web.git","ssh_url":"git@github.com:Hughp135/osu-web.git","clone_url":"https://github.com/Hughp135/osu-web.git","svn_url":"https://github.com/Hughp135/osu-web","homepage":null,"size":15449,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"master"}},"base":{"label":"ppy:master","ref":"master","sha":"6bb4e2ace5db3f0c863678beac25863b5e38cc3f","user":{"login":"ppy","id":995763,"avatar_url":"https://avatars.githubusercontent.com/u/995763?v=3","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,"name":"osu-web","full_name":"ppy/osu-web","owner":{"login":"ppy","id":995763,"avatar_url":"https://avatars.githubusercontent.com/u/995763?v=3","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 future face 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":"2016-02-19T10:24:39Z","pushed_at":"2016-02-22T10:23:59Z","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":null,"size":15644,"stargazers_count":140,"watchers_count":140,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"open_issues_count":48,"forks":44,"open_issues":48,"watchers":140,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/392"},"html":{"href":"https://github.com/ppy/osu-web/pull/392"},"issue":{"href":"https://api.github.com/repos/ppy/osu-web/issues/392"},"comments":{"href":"https://api.github.com/repos/ppy/osu-web/issues/392/comments"},"review_comments":{"href":"https://api.github.com/repos/ppy/osu-web/pulls/392/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/392/commits"},"statuses":{"href":"https://api.github.com/repos/ppy/osu-web/statuses/e2a42c948b997907e116f2f9b16c211f98b09c34"}}}}