{"action":"created","comment":{"url":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/comments/96162008","pull_request_review_id":16737723,"id":96162008,"diff_hunk":"@@ -0,0 +1,43 @@\n+# frozen_string_literal: true\n+# == Schema Information\n+#\n+# Table name: battles\n+#\n+#  id          :integer          not null, primary key\n+#  strategy_id :integer          not null\n+#  opponent_id :integer          not null\n+#  result      :integer          not null\n+#  log_path    :string\n+#  created_at  :datetime         not null\n+#  updated_at  :datetime         not null\n+#\n+\n+class Battle < ActiveRecord::Base\n+  belongs_to :strategy\n+\n+  class << self\n+    # FirstBattleManagerから呼び出し\n+    def regist_battles(league_id, battles)\n+      save_dir = File.join(DataPath::BATTLE_LOG_DIR, League.find(league_id).name)\n+      FileUtils.mkdir_p(save_dir) unless FileTest.exist?(save_dir)\n+      p battles\n+      # 登録処理\n+      battles.each do |hash|\n+        register = Battle.new\n+        register.strategy_id = hash['strategy_id'].to_i\n+        register.opponent_id = hash['opponent_id'].to_i\n+        register.result = hash['result']\n+        register.log_path = save_log_file(hash['log_path'], save_dir, hash['strategy_name'], hash['opponent_name'])\n+        register.save!\n+      end\n+    end\n+\n+    private\n+\n+    def save_log_file(source_path, target_dir, strategy_name, opponent_name)\n+      file_name = File.join(target_dir, \"#{DateTime.now.strftime('%Y%m%d_%H%M%S')}-#{strategy_name}-#{opponent_name}.xml\")","path":"app/models/battle.rb","position":38,"original_position":38,"commit_id":"30c2f4874077ac1fda41cd0e89977eee24cfe7b2","original_commit_id":"30c2f4874077ac1fda41cd0e89977eee24cfe7b2","user":{"login":"hanasuke","id":2376843,"avatar_url":"https://avatars.githubusercontent.com/u/2376843?v=3","gravatar_id":"","url":"https://api.github.com/users/hanasuke","html_url":"https://github.com/hanasuke","followers_url":"https://api.github.com/users/hanasuke/followers","following_url":"https://api.github.com/users/hanasuke/following{/other_user}","gists_url":"https://api.github.com/users/hanasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/hanasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanasuke/subscriptions","organizations_url":"https://api.github.com/users/hanasuke/orgs","repos_url":"https://api.github.com/users/hanasuke/repos","events_url":"https://api.github.com/users/hanasuke/events{/privacy}","received_events_url":"https://api.github.com/users/hanasuke/received_events","type":"User","site_admin":false},"body":"__[rubocop]__\n* Do not use `DateTime.now.strftime` without zone. Use one of `Time.zone.now.strftime`, `DateTime.current`, `DateTime.now.strftime.in_time_zone`, `DateTime.now.strftime.utc`, `DateTime.now.strftime.getlocal`, `DateTime.now.strftime.iso8601`, `DateTime.now.strftime.jisx0301`, `DateTime.now.strftime.rfc3339`, `DateTime.now.strftime.to_i`, `DateTime.now.strftime.to_f` instead. [:ref](https://github.com/bbatsov/rails-style-guide#time, http://danilenko.org/2012/7/6/rails_timezones)\n\n<!-- Comment by [SideCI](https://sideci.com) -->","created_at":"2017-01-16T03:59:34Z","updated_at":"2017-01-16T03:59:34Z","html_url":"https://github.com/hanasuke/wing-cs-front/pull/18#discussion_r96162008","pull_request_url":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/comments/96162008"},"html":{"href":"https://github.com/hanasuke/wing-cs-front/pull/18#discussion_r96162008"},"pull_request":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/18","id":101149876,"html_url":"https://github.com/hanasuke/wing-cs-front/pull/18","diff_url":"https://github.com/hanasuke/wing-cs-front/pull/18.diff","patch_url":"https://github.com/hanasuke/wing-cs-front/pull/18.patch","issue_url":"https://api.github.com/repos/hanasuke/wing-cs-front/issues/18","number":18,"state":"open","locked":false,"title":"[WIP] 受入テスト後の初期対戦の処理を実装","user":{"login":"hanasuke","id":2376843,"avatar_url":"https://avatars.githubusercontent.com/u/2376843?v=3","gravatar_id":"","url":"https://api.github.com/users/hanasuke","html_url":"https://github.com/hanasuke","followers_url":"https://api.github.com/users/hanasuke/followers","following_url":"https://api.github.com/users/hanasuke/following{/other_user}","gists_url":"https://api.github.com/users/hanasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/hanasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanasuke/subscriptions","organizations_url":"https://api.github.com/users/hanasuke/orgs","repos_url":"https://api.github.com/users/hanasuke/repos","events_url":"https://api.github.com/users/hanasuke/events{/privacy}","received_events_url":"https://api.github.com/users/hanasuke/received_events","type":"User","site_admin":false},"body":"please merge after #17 ","created_at":"2017-01-11T21:27:53Z","updated_at":"2017-01-16T03:59:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e93590beb0bece1d55d8d4d270588dc1f94c2f6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/18/commits","review_comments_url":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/18/comments","review_comment_url":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hanasuke/wing-cs-front/issues/18/comments","statuses_url":"https://api.github.com/repos/hanasuke/wing-cs-front/statuses/30c2f4874077ac1fda41cd0e89977eee24cfe7b2","head":{"label":"hanasuke:implement_first_battle_function","ref":"implement_first_battle_function","sha":"30c2f4874077ac1fda41cd0e89977eee24cfe7b2","user":{"login":"hanasuke","id":2376843,"avatar_url":"https://avatars.githubusercontent.com/u/2376843?v=3","gravatar_id":"","url":"https://api.github.com/users/hanasuke","html_url":"https://github.com/hanasuke","followers_url":"https://api.github.com/users/hanasuke/followers","following_url":"https://api.github.com/users/hanasuke/following{/other_user}","gists_url":"https://api.github.com/users/hanasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/hanasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanasuke/subscriptions","organizations_url":"https://api.github.com/users/hanasuke/orgs","repos_url":"https://api.github.com/users/hanasuke/repos","events_url":"https://api.github.com/users/hanasuke/events{/privacy}","received_events_url":"https://api.github.com/users/hanasuke/received_events","type":"User","site_admin":false},"repo":{"id":61987716,"name":"wing-cs-front","full_name":"hanasuke/wing-cs-front","owner":{"login":"hanasuke","id":2376843,"avatar_url":"https://avatars.githubusercontent.com/u/2376843?v=3","gravatar_id":"","url":"https://api.github.com/users/hanasuke","html_url":"https://github.com/hanasuke","followers_url":"https://api.github.com/users/hanasuke/followers","following_url":"https://api.github.com/users/hanasuke/following{/other_user}","gists_url":"https://api.github.com/users/hanasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/hanasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanasuke/subscriptions","organizations_url":"https://api.github.com/users/hanasuke/orgs","repos_url":"https://api.github.com/users/hanasuke/repos","events_url":"https://api.github.com/users/hanasuke/events{/privacy}","received_events_url":"https://api.github.com/users/hanasuke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hanasuke/wing-cs-front","description":null,"fork":false,"url":"https://api.github.com/repos/hanasuke/wing-cs-front","forks_url":"https://api.github.com/repos/hanasuke/wing-cs-front/forks","keys_url":"https://api.github.com/repos/hanasuke/wing-cs-front/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hanasuke/wing-cs-front/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hanasuke/wing-cs-front/teams","hooks_url":"https://api.github.com/repos/hanasuke/wing-cs-front/hooks","issue_events_url":"https://api.github.com/repos/hanasuke/wing-cs-front/issues/events{/number}","events_url":"https://api.github.com/repos/hanasuke/wing-cs-front/events","assignees_url":"https://api.github.com/repos/hanasuke/wing-cs-front/assignees{/user}","branches_url":"https://api.github.com/repos/hanasuke/wing-cs-front/branches{/branch}","tags_url":"https://api.github.com/repos/hanasuke/wing-cs-front/tags","blobs_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/refs{/sha}","trees_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hanasuke/wing-cs-front/statuses/{sha}","languages_url":"https://api.github.com/repos/hanasuke/wing-cs-front/languages","stargazers_url":"https://api.github.com/repos/hanasuke/wing-cs-front/stargazers","contributors_url":"https://api.github.com/repos/hanasuke/wing-cs-front/contributors","subscribers_url":"https://api.github.com/repos/hanasuke/wing-cs-front/subscribers","subscription_url":"https://api.github.com/repos/hanasuke/wing-cs-front/subscription","commits_url":"https://api.github.com/repos/hanasuke/wing-cs-front/commits{/sha}","git_commits_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/commits{/sha}","comments_url":"https://api.github.com/repos/hanasuke/wing-cs-front/comments{/number}","issue_comment_url":"https://api.github.com/repos/hanasuke/wing-cs-front/issues/comments{/number}","contents_url":"https://api.github.com/repos/hanasuke/wing-cs-front/contents/{+path}","compare_url":"https://api.github.com/repos/hanasuke/wing-cs-front/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hanasuke/wing-cs-front/merges","archive_url":"https://api.github.com/repos/hanasuke/wing-cs-front/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hanasuke/wing-cs-front/downloads","issues_url":"https://api.github.com/repos/hanasuke/wing-cs-front/issues{/number}","pulls_url":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls{/number}","milestones_url":"https://api.github.com/repos/hanasuke/wing-cs-front/milestones{/number}","notifications_url":"https://api.github.com/repos/hanasuke/wing-cs-front/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hanasuke/wing-cs-front/labels{/name}","releases_url":"https://api.github.com/repos/hanasuke/wing-cs-front/releases{/id}","deployments_url":"https://api.github.com/repos/hanasuke/wing-cs-front/deployments","created_at":"2016-06-26T12:18:12Z","updated_at":"2017-01-12T09:54:52Z","pushed_at":"2017-01-16T03:59:30Z","git_url":"git://github.com/hanasuke/wing-cs-front.git","ssh_url":"git@github.com:hanasuke/wing-cs-front.git","clone_url":"https://github.com/hanasuke/wing-cs-front.git","svn_url":"https://github.com/hanasuke/wing-cs-front","homepage":null,"size":143,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"hanasuke:master","ref":"master","sha":"f14a85aa83acec459f56694afc0a80ac16000614","user":{"login":"hanasuke","id":2376843,"avatar_url":"https://avatars.githubusercontent.com/u/2376843?v=3","gravatar_id":"","url":"https://api.github.com/users/hanasuke","html_url":"https://github.com/hanasuke","followers_url":"https://api.github.com/users/hanasuke/followers","following_url":"https://api.github.com/users/hanasuke/following{/other_user}","gists_url":"https://api.github.com/users/hanasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/hanasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanasuke/subscriptions","organizations_url":"https://api.github.com/users/hanasuke/orgs","repos_url":"https://api.github.com/users/hanasuke/repos","events_url":"https://api.github.com/users/hanasuke/events{/privacy}","received_events_url":"https://api.github.com/users/hanasuke/received_events","type":"User","site_admin":false},"repo":{"id":61987716,"name":"wing-cs-front","full_name":"hanasuke/wing-cs-front","owner":{"login":"hanasuke","id":2376843,"avatar_url":"https://avatars.githubusercontent.com/u/2376843?v=3","gravatar_id":"","url":"https://api.github.com/users/hanasuke","html_url":"https://github.com/hanasuke","followers_url":"https://api.github.com/users/hanasuke/followers","following_url":"https://api.github.com/users/hanasuke/following{/other_user}","gists_url":"https://api.github.com/users/hanasuke/gists{/gist_id}","starred_url":"https://api.github.com/users/hanasuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanasuke/subscriptions","organizations_url":"https://api.github.com/users/hanasuke/orgs","repos_url":"https://api.github.com/users/hanasuke/repos","events_url":"https://api.github.com/users/hanasuke/events{/privacy}","received_events_url":"https://api.github.com/users/hanasuke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hanasuke/wing-cs-front","description":null,"fork":false,"url":"https://api.github.com/repos/hanasuke/wing-cs-front","forks_url":"https://api.github.com/repos/hanasuke/wing-cs-front/forks","keys_url":"https://api.github.com/repos/hanasuke/wing-cs-front/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hanasuke/wing-cs-front/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hanasuke/wing-cs-front/teams","hooks_url":"https://api.github.com/repos/hanasuke/wing-cs-front/hooks","issue_events_url":"https://api.github.com/repos/hanasuke/wing-cs-front/issues/events{/number}","events_url":"https://api.github.com/repos/hanasuke/wing-cs-front/events","assignees_url":"https://api.github.com/repos/hanasuke/wing-cs-front/assignees{/user}","branches_url":"https://api.github.com/repos/hanasuke/wing-cs-front/branches{/branch}","tags_url":"https://api.github.com/repos/hanasuke/wing-cs-front/tags","blobs_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/refs{/sha}","trees_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hanasuke/wing-cs-front/statuses/{sha}","languages_url":"https://api.github.com/repos/hanasuke/wing-cs-front/languages","stargazers_url":"https://api.github.com/repos/hanasuke/wing-cs-front/stargazers","contributors_url":"https://api.github.com/repos/hanasuke/wing-cs-front/contributors","subscribers_url":"https://api.github.com/repos/hanasuke/wing-cs-front/subscribers","subscription_url":"https://api.github.com/repos/hanasuke/wing-cs-front/subscription","commits_url":"https://api.github.com/repos/hanasuke/wing-cs-front/commits{/sha}","git_commits_url":"https://api.github.com/repos/hanasuke/wing-cs-front/git/commits{/sha}","comments_url":"https://api.github.com/repos/hanasuke/wing-cs-front/comments{/number}","issue_comment_url":"https://api.github.com/repos/hanasuke/wing-cs-front/issues/comments{/number}","contents_url":"https://api.github.com/repos/hanasuke/wing-cs-front/contents/{+path}","compare_url":"https://api.github.com/repos/hanasuke/wing-cs-front/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hanasuke/wing-cs-front/merges","archive_url":"https://api.github.com/repos/hanasuke/wing-cs-front/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hanasuke/wing-cs-front/downloads","issues_url":"https://api.github.com/repos/hanasuke/wing-cs-front/issues{/number}","pulls_url":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls{/number}","milestones_url":"https://api.github.com/repos/hanasuke/wing-cs-front/milestones{/number}","notifications_url":"https://api.github.com/repos/hanasuke/wing-cs-front/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hanasuke/wing-cs-front/labels{/name}","releases_url":"https://api.github.com/repos/hanasuke/wing-cs-front/releases{/id}","deployments_url":"https://api.github.com/repos/hanasuke/wing-cs-front/deployments","created_at":"2016-06-26T12:18:12Z","updated_at":"2017-01-12T09:54:52Z","pushed_at":"2017-01-16T03:59:30Z","git_url":"git://github.com/hanasuke/wing-cs-front.git","ssh_url":"git@github.com:hanasuke/wing-cs-front.git","clone_url":"https://github.com/hanasuke/wing-cs-front.git","svn_url":"https://github.com/hanasuke/wing-cs-front","homepage":null,"size":143,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/18"},"html":{"href":"https://github.com/hanasuke/wing-cs-front/pull/18"},"issue":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/issues/18"},"comments":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/hanasuke/wing-cs-front/statuses/30c2f4874077ac1fda41cd0e89977eee24cfe7b2"}}}}
{"actor":{"display_login":"hanasuke"}}