{"action":"created","comment":{"url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/comments/28418920","id":28418920,"diff_hunk":"@@ -68,32 +69,87 @@ module.exports = React.createClass({\n \n     getInitialState: function() {\n         return {\n-            init: false\n+            status: 'loading'\n         };\n     },\n \n+    setStateIfMounted: function(s) {\n+        if (this.isMounted()) {\n+            this.setState(s);\n+        }\n+    },\n+\n     componentDidMount: function() {\n+        var data = {\n+            user: this.props.token,\n+            report: this.props.report,\n+        };\n+\n         api.get({\n-            api: 'test_result',\n-            data: {\n-                user: this.props.token,\n-                report: this.props.report\n-            }\n-        }).done(function(result) {\n-            if (this.isMounted()) {\n-                this.setState({\n-                    test_result: result,\n-                    init: true\n+            api: 'user',\n+            data: _.assign({ type: 'status' }, data)\n+        }).done(function(u) {\n+            status = u[0].report[this.props.report].status;\n+            switch (status) {\n+            case 'report':\n+            case 'OK':\n+                api.get({\n+                    api: 'test_result',\n+                    data: data\n+                }).done(function(result) {\n+                    this.setStateIfMounted({\n+                        test_result: result,\n+                        status: 'done'\n+                    });\n+                }.bind(this));\n+                break;\n+\n+            case 'build':\n+            case 'check':\n+                this.setStateIfMounted({\n+                    status: 'loading'\n+                });\n+                setTimeout(this.componentDidMount.bind(this), 3 * 1000);","path":"js/record/result_view.js","position":78,"original_position":72,"commit_id":"8423725270550d1d7693d3e2c6e81a61a2197dc6","original_commit_id":"c380ef5b1a3adc29e23bbf64b7d1550cab57c136","user":{"login":"sowa-snow","id":3582091,"avatar_url":"https://avatars.githubusercontent.com/u/3582091?v=3","gravatar_id":"","url":"https://api.github.com/users/sowa-snow","html_url":"https://github.com/sowa-snow","followers_url":"https://api.github.com/users/sowa-snow/followers","following_url":"https://api.github.com/users/sowa-snow/following{/other_user}","gists_url":"https://api.github.com/users/sowa-snow/gists{/gist_id}","starred_url":"https://api.github.com/users/sowa-snow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sowa-snow/subscriptions","organizations_url":"https://api.github.com/users/sowa-snow/orgs","repos_url":"https://api.github.com/users/sowa-snow/repos","events_url":"https://api.github.com/users/sowa-snow/events{/privacy}","received_events_url":"https://api.github.com/users/sowa-snow/received_events","type":"User","site_admin":false},"body":"とりあえずthisがどうなるかの問題はおいておいて、DidMountを再呼び出しするのは（Reactの使い方的に）良くないのでは？","created_at":"2015-04-15T13:33:12Z","updated_at":"2015-04-15T13:33:12Z","html_url":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata/pull/335#discussion_r28418920","pull_request_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/335","_links":{"self":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/comments/28418920"},"html":{"href":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata/pull/335#discussion_r28418920"},"pull_request":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/335"}}},"pull_request":{"url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/335","id":33225712,"html_url":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata/pull/335","diff_url":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata/pull/335.diff","patch_url":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata/pull/335.patch","issue_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/issues/335","number":335,"state":"open","locked":false,"title":"Result view/wait for tests","user":{"login":"skymountain","id":338200,"avatar_url":"https://avatars.githubusercontent.com/u/338200?v=3","gravatar_id":"","url":"https://api.github.com/users/skymountain","html_url":"https://github.com/skymountain","followers_url":"https://api.github.com/users/skymountain/followers","following_url":"https://api.github.com/users/skymountain/following{/other_user}","gists_url":"https://api.github.com/users/skymountain/gists{/gist_id}","starred_url":"https://api.github.com/users/skymountain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skymountain/subscriptions","organizations_url":"https://api.github.com/users/skymountain/orgs","repos_url":"https://api.github.com/users/skymountain/repos","events_url":"https://api.github.com/users/skymountain/events{/privacy}","received_events_url":"https://api.github.com/users/skymountain/received_events","type":"User","site_admin":false},"body":"Fix #241.\r\n\r\nテストが終わるまでテスト結果を表示しないようにしました．","created_at":"2015-04-14T04:35:16Z","updated_at":"2015-04-15T13:33:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbb0d34c28849d0b23f0ec791639e71e0582de33","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/335/commits","review_comments_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/335/comments","review_comment_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/issues/335/comments","statuses_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/statuses/8423725270550d1d7693d3e2c6e81a61a2197dc6","head":{"label":"skymountain:result-view/wait-for-tests","ref":"result-view/wait-for-tests","sha":"8423725270550d1d7693d3e2c6e81a61a2197dc6","user":{"login":"skymountain","id":338200,"avatar_url":"https://avatars.githubusercontent.com/u/338200?v=3","gravatar_id":"","url":"https://api.github.com/users/skymountain","html_url":"https://github.com/skymountain","followers_url":"https://api.github.com/users/skymountain/followers","following_url":"https://api.github.com/users/skymountain/following{/other_user}","gists_url":"https://api.github.com/users/skymountain/gists{/gist_id}","starred_url":"https://api.github.com/users/skymountain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skymountain/subscriptions","organizations_url":"https://api.github.com/users/skymountain/orgs","repos_url":"https://api.github.com/users/skymountain/repos","events_url":"https://api.github.com/users/skymountain/events{/privacy}","received_events_url":"https://api.github.com/users/skymountain/received_events","type":"User","site_admin":false},"repo":{"id":12915633,"name":"automata","full_name":"skymountain/automata","owner":{"login":"skymountain","id":338200,"avatar_url":"https://avatars.githubusercontent.com/u/338200?v=3","gravatar_id":"","url":"https://api.github.com/users/skymountain","html_url":"https://github.com/skymountain","followers_url":"https://api.github.com/users/skymountain/followers","following_url":"https://api.github.com/users/skymountain/following{/other_user}","gists_url":"https://api.github.com/users/skymountain/gists{/gist_id}","starred_url":"https://api.github.com/users/skymountain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skymountain/subscriptions","organizations_url":"https://api.github.com/users/skymountain/orgs","repos_url":"https://api.github.com/users/skymountain/repos","events_url":"https://api.github.com/users/skymountain/events{/privacy}","received_events_url":"https://api.github.com/users/skymountain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/skymountain/automata","description":null,"fork":true,"url":"https://api.github.com/repos/skymountain/automata","forks_url":"https://api.github.com/repos/skymountain/automata/forks","keys_url":"https://api.github.com/repos/skymountain/automata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skymountain/automata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skymountain/automata/teams","hooks_url":"https://api.github.com/repos/skymountain/automata/hooks","issue_events_url":"https://api.github.com/repos/skymountain/automata/issues/events{/number}","events_url":"https://api.github.com/repos/skymountain/automata/events","assignees_url":"https://api.github.com/repos/skymountain/automata/assignees{/user}","branches_url":"https://api.github.com/repos/skymountain/automata/branches{/branch}","tags_url":"https://api.github.com/repos/skymountain/automata/tags","blobs_url":"https://api.github.com/repos/skymountain/automata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skymountain/automata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skymountain/automata/git/refs{/sha}","trees_url":"https://api.github.com/repos/skymountain/automata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skymountain/automata/statuses/{sha}","languages_url":"https://api.github.com/repos/skymountain/automata/languages","stargazers_url":"https://api.github.com/repos/skymountain/automata/stargazers","contributors_url":"https://api.github.com/repos/skymountain/automata/contributors","subscribers_url":"https://api.github.com/repos/skymountain/automata/subscribers","subscription_url":"https://api.github.com/repos/skymountain/automata/subscription","commits_url":"https://api.github.com/repos/skymountain/automata/commits{/sha}","git_commits_url":"https://api.github.com/repos/skymountain/automata/git/commits{/sha}","comments_url":"https://api.github.com/repos/skymountain/automata/comments{/number}","issue_comment_url":"https://api.github.com/repos/skymountain/automata/issues/comments{/number}","contents_url":"https://api.github.com/repos/skymountain/automata/contents/{+path}","compare_url":"https://api.github.com/repos/skymountain/automata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skymountain/automata/merges","archive_url":"https://api.github.com/repos/skymountain/automata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skymountain/automata/downloads","issues_url":"https://api.github.com/repos/skymountain/automata/issues{/number}","pulls_url":"https://api.github.com/repos/skymountain/automata/pulls{/number}","milestones_url":"https://api.github.com/repos/skymountain/automata/milestones{/number}","notifications_url":"https://api.github.com/repos/skymountain/automata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skymountain/automata/labels{/name}","releases_url":"https://api.github.com/repos/skymountain/automata/releases{/id}","created_at":"2013-09-18T06:20:55Z","updated_at":"2015-04-05T13:36:23Z","pushed_at":"2015-04-15T07:21:39Z","git_url":"git://github.com/skymountain/automata.git","ssh_url":"git@github.com:skymountain/automata.git","clone_url":"https://github.com/skymountain/automata.git","svn_url":"https://github.com/skymountain/automata","homepage":null,"size":2553,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"SoftwareFoundationGroupAtKyotoU:master","ref":"master","sha":"d5b080341860bc5e29e65016466444db539cad52","user":{"login":"SoftwareFoundationGroupAtKyotoU","id":9034238,"avatar_url":"https://avatars.githubusercontent.com/u/9034238?v=3","gravatar_id":"","url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU","html_url":"https://github.com/SoftwareFoundationGroupAtKyotoU","followers_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/followers","following_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/following{/other_user}","gists_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/gists{/gist_id}","starred_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/subscriptions","organizations_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/orgs","repos_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/repos","events_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/events{/privacy}","received_events_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/received_events","type":"Organization","site_admin":false},"repo":{"id":3335051,"name":"automata","full_name":"SoftwareFoundationGroupAtKyotoU/automata","owner":{"login":"SoftwareFoundationGroupAtKyotoU","id":9034238,"avatar_url":"https://avatars.githubusercontent.com/u/9034238?v=3","gravatar_id":"","url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU","html_url":"https://github.com/SoftwareFoundationGroupAtKyotoU","followers_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/followers","following_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/following{/other_user}","gists_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/gists{/gist_id}","starred_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/subscriptions","organizations_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/orgs","repos_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/repos","events_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/events{/privacy}","received_events_url":"https://api.github.com/users/SoftwareFoundationGroupAtKyotoU/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata","description":null,"fork":false,"url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata","forks_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/forks","keys_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/teams","hooks_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/hooks","issue_events_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/issues/events{/number}","events_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/events","assignees_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/assignees{/user}","branches_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/branches{/branch}","tags_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/tags","blobs_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/git/refs{/sha}","trees_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/statuses/{sha}","languages_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/languages","stargazers_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/stargazers","contributors_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/contributors","subscribers_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/subscribers","subscription_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/subscription","commits_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/commits{/sha}","git_commits_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/git/commits{/sha}","comments_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/comments{/number}","issue_comment_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/issues/comments{/number}","contents_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/contents/{+path}","compare_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/merges","archive_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/downloads","issues_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/issues{/number}","pulls_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls{/number}","milestones_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/milestones{/number}","notifications_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/labels{/name}","releases_url":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/releases{/id}","created_at":"2012-02-02T13:48:27Z","updated_at":"2015-04-15T05:48:49Z","pushed_at":"2015-04-15T07:21:39Z","git_url":"git://github.com/SoftwareFoundationGroupAtKyotoU/automata.git","ssh_url":"git@github.com:SoftwareFoundationGroupAtKyotoU/automata.git","clone_url":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata.git","svn_url":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata","homepage":null,"size":5448,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":35,"forks":9,"open_issues":35,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/335"},"html":{"href":"https://github.com/SoftwareFoundationGroupAtKyotoU/automata/pull/335"},"issue":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/issues/335"},"comments":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/issues/335/comments"},"review_comments":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/335/comments"},"review_comment":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/pulls/335/commits"},"statuses":{"href":"https://api.github.com/repos/SoftwareFoundationGroupAtKyotoU/automata/statuses/8423725270550d1d7693d3e2c6e81a61a2197dc6"}}}}