{"action":"created","issue":{"url":"https://api.github.com/repos/muyjohno/desperado/issues/56","labels_url":"https://api.github.com/repos/muyjohno/desperado/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/muyjohno/desperado/issues/56/comments","events_url":"https://api.github.com/repos/muyjohno/desperado/issues/56/events","html_url":"https://github.com/muyjohno/desperado/pull/56","id":114410080,"number":56,"title":"Import achievements as rake task","user":{"login":"richdouglasevans","id":1855109,"avatar_url":"https://avatars.githubusercontent.com/u/1855109?v=3","gravatar_id":"","url":"https://api.github.com/users/richdouglasevans","html_url":"https://github.com/richdouglasevans","followers_url":"https://api.github.com/users/richdouglasevans/followers","following_url":"https://api.github.com/users/richdouglasevans/following{/other_user}","gists_url":"https://api.github.com/users/richdouglasevans/gists{/gist_id}","starred_url":"https://api.github.com/users/richdouglasevans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richdouglasevans/subscriptions","organizations_url":"https://api.github.com/users/richdouglasevans/orgs","repos_url":"https://api.github.com/users/richdouglasevans/repos","events_url":"https://api.github.com/users/richdouglasevans/events{/privacy}","received_events_url":"https://api.github.com/users/richdouglasevans/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-31T12:58:34Z","updated_at":"2015-11-04T11:24:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/muyjohno/desperado/pulls/56","html_url":"https://github.com/muyjohno/desperado/pull/56","diff_url":"https://github.com/muyjohno/desperado/pull/56.diff","patch_url":"https://github.com/muyjohno/desperado/pull/56.patch"},"body":"The current application allows the administrator to add achievements via the user interface. This is fine, but it involves a lot of clicking around, page transitions, and copy&paste.\r\n\r\nThis patch effects the import of achievements sourced from a structured text file into the DB. The benefits here are that:\r\n\r\n* the achievements can be versioned.\r\n* importing achievements now takes mere seconds.\r\n* the achievements can be shared and imported among leagues.\r\n* adding new achievements is as easy as editing as text file.\r\n\r\nThe following code snippet imports the achievements listed in the YAML file into the DB.\r\n\r\n```bash\r\nrake desperado:import_achievements[/home/rich/dev/netrunner/desperado/data/achievements/season_01.yaml]\r\n```\r\n\r\n## Not Very Smart\r\n\r\nThe current implementation merely slurps the YAML and saves the achievement directly to the DB. There's no smarts here: for example, there is no check to see if an achievment with the same name already exists.\r\n\r\nIf more smarts were required I'd cut the achievement importing code out into a dedicated `AchievementImporter` class/function to enable easier testing and to keep the rake task small.\r\n\r\nI didn't go there immediately because this works and I'd rather get your feedback earlier before assembling a mountain of turd."},"comment":{"url":"https://api.github.com/repos/muyjohno/desperado/issues/comments/153690955","html_url":"https://github.com/muyjohno/desperado/pull/56#issuecomment-153690955","issue_url":"https://api.github.com/repos/muyjohno/desperado/issues/56","id":153690955,"user":{"login":"muyjohno","id":242952,"avatar_url":"https://avatars.githubusercontent.com/u/242952?v=3","gravatar_id":"","url":"https://api.github.com/users/muyjohno","html_url":"https://github.com/muyjohno","followers_url":"https://api.github.com/users/muyjohno/followers","following_url":"https://api.github.com/users/muyjohno/following{/other_user}","gists_url":"https://api.github.com/users/muyjohno/gists{/gist_id}","starred_url":"https://api.github.com/users/muyjohno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muyjohno/subscriptions","organizations_url":"https://api.github.com/users/muyjohno/orgs","repos_url":"https://api.github.com/users/muyjohno/repos","events_url":"https://api.github.com/users/muyjohno/events{/privacy}","received_events_url":"https://api.github.com/users/muyjohno/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T11:24:25Z","updated_at":"2015-11-04T11:24:25Z","body":"Thanks!"}}