{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/tms_39/pulls/comments/45825333","id":45825333,"diff_hunk":"@@ -22,4 +23,25 @@ def created_course\n   def updated_course\n     Activity.add_activity Activity::ACTION[:UPDATE_COURSE], self.id, user_id\n   end\n+\n+  def traineeJoinCourse\n+    if self.open?\n+      self.trainees.notBelongToAnyCourse.update_all course_id: self.id\n+    end\n+  end\n+\n+  def initCourse\n+    if self.open?\n+      course_subjects.each do |course_subject|\n+        trainees.each do |trainee|\n+          subject = course_subject.subject\n+          user_course = trainee.user_courses.find_by(course_id: self.id)","path":"app/models/course.rb","position":31,"original_position":31,"commit_id":"9ec89ac99356987bd87c730ef35ba75ea1bed132","original_commit_id":"9ec89ac99356987bd87c730ef35ba75ea1bed132","user":{"login":"chuanhtuan","id":5590771,"avatar_url":"https://avatars.githubusercontent.com/u/5590771?v=3","gravatar_id":"","url":"https://api.github.com/users/chuanhtuan","html_url":"https://github.com/chuanhtuan","followers_url":"https://api.github.com/users/chuanhtuan/followers","following_url":"https://api.github.com/users/chuanhtuan/following{/other_user}","gists_url":"https://api.github.com/users/chuanhtuan/gists{/gist_id}","starred_url":"https://api.github.com/users/chuanhtuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuanhtuan/subscriptions","organizations_url":"https://api.github.com/users/chuanhtuan/orgs","repos_url":"https://api.github.com/users/chuanhtuan/repos","events_url":"https://api.github.com/users/chuanhtuan/events{/privacy}","received_events_url":"https://api.github.com/users/chuanhtuan/received_events","type":"User","site_admin":false},"body":"mỗi lần chạy lại find lại một lần rất là mất công\r\ntheo anh, thay vì foreach theo trainees, em nên foreach theo user_courses","created_at":"2015-11-25T03:10:15Z","updated_at":"2015-11-25T03:10:15Z","html_url":"https://github.com/framgia/tms_39/pull/23#discussion_r45825333","pull_request_url":"https://api.github.com/repos/framgia/tms_39/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/comments/45825333"},"html":{"href":"https://github.com/framgia/tms_39/pull/23#discussion_r45825333"},"pull_request":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/tms_39/pulls/23","id":51175739,"html_url":"https://github.com/framgia/tms_39/pull/23","diff_url":"https://github.com/framgia/tms_39/pull/23.diff","patch_url":"https://github.com/framgia/tms_39/pull/23.patch","issue_url":"https://api.github.com/repos/framgia/tms_39/issues/23","number":23,"state":"open","locked":false,"title":"45534-supervisor-start-course","user":{"login":"tuanna2704","id":11383378,"avatar_url":"https://avatars.githubusercontent.com/u/11383378?v=3","gravatar_id":"","url":"https://api.github.com/users/tuanna2704","html_url":"https://github.com/tuanna2704","followers_url":"https://api.github.com/users/tuanna2704/followers","following_url":"https://api.github.com/users/tuanna2704/following{/other_user}","gists_url":"https://api.github.com/users/tuanna2704/gists{/gist_id}","starred_url":"https://api.github.com/users/tuanna2704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuanna2704/subscriptions","organizations_url":"https://api.github.com/users/tuanna2704/orgs","repos_url":"https://api.github.com/users/tuanna2704/repos","events_url":"https://api.github.com/users/tuanna2704/events{/privacy}","received_events_url":"https://api.github.com/users/tuanna2704/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-19T03:24:43Z","updated_at":"2015-11-25T03:10:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"13922e22314540c449326073ce159607a7d44953","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/tms_39/pulls/23/commits","review_comments_url":"https://api.github.com/repos/framgia/tms_39/pulls/23/comments","review_comment_url":"https://api.github.com/repos/framgia/tms_39/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/tms_39/issues/23/comments","statuses_url":"https://api.github.com/repos/framgia/tms_39/statuses/9ec89ac99356987bd87c730ef35ba75ea1bed132","head":{"label":"tuanna2704:45534-supervisor-start-course","ref":"45534-supervisor-start-course","sha":"9ec89ac99356987bd87c730ef35ba75ea1bed132","user":{"login":"tuanna2704","id":11383378,"avatar_url":"https://avatars.githubusercontent.com/u/11383378?v=3","gravatar_id":"","url":"https://api.github.com/users/tuanna2704","html_url":"https://github.com/tuanna2704","followers_url":"https://api.github.com/users/tuanna2704/followers","following_url":"https://api.github.com/users/tuanna2704/following{/other_user}","gists_url":"https://api.github.com/users/tuanna2704/gists{/gist_id}","starred_url":"https://api.github.com/users/tuanna2704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuanna2704/subscriptions","organizations_url":"https://api.github.com/users/tuanna2704/orgs","repos_url":"https://api.github.com/users/tuanna2704/repos","events_url":"https://api.github.com/users/tuanna2704/events{/privacy}","received_events_url":"https://api.github.com/users/tuanna2704/received_events","type":"User","site_admin":false},"repo":{"id":45515677,"name":"tms_39","full_name":"tuanna2704/tms_39","owner":{"login":"tuanna2704","id":11383378,"avatar_url":"https://avatars.githubusercontent.com/u/11383378?v=3","gravatar_id":"","url":"https://api.github.com/users/tuanna2704","html_url":"https://github.com/tuanna2704","followers_url":"https://api.github.com/users/tuanna2704/followers","following_url":"https://api.github.com/users/tuanna2704/following{/other_user}","gists_url":"https://api.github.com/users/tuanna2704/gists{/gist_id}","starred_url":"https://api.github.com/users/tuanna2704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuanna2704/subscriptions","organizations_url":"https://api.github.com/users/tuanna2704/orgs","repos_url":"https://api.github.com/users/tuanna2704/repos","events_url":"https://api.github.com/users/tuanna2704/events{/privacy}","received_events_url":"https://api.github.com/users/tuanna2704/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tuanna2704/tms_39","description":"Framgia Training Management System (training)","fork":true,"url":"https://api.github.com/repos/tuanna2704/tms_39","forks_url":"https://api.github.com/repos/tuanna2704/tms_39/forks","keys_url":"https://api.github.com/repos/tuanna2704/tms_39/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tuanna2704/tms_39/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tuanna2704/tms_39/teams","hooks_url":"https://api.github.com/repos/tuanna2704/tms_39/hooks","issue_events_url":"https://api.github.com/repos/tuanna2704/tms_39/issues/events{/number}","events_url":"https://api.github.com/repos/tuanna2704/tms_39/events","assignees_url":"https://api.github.com/repos/tuanna2704/tms_39/assignees{/user}","branches_url":"https://api.github.com/repos/tuanna2704/tms_39/branches{/branch}","tags_url":"https://api.github.com/repos/tuanna2704/tms_39/tags","blobs_url":"https://api.github.com/repos/tuanna2704/tms_39/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tuanna2704/tms_39/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tuanna2704/tms_39/git/refs{/sha}","trees_url":"https://api.github.com/repos/tuanna2704/tms_39/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tuanna2704/tms_39/statuses/{sha}","languages_url":"https://api.github.com/repos/tuanna2704/tms_39/languages","stargazers_url":"https://api.github.com/repos/tuanna2704/tms_39/stargazers","contributors_url":"https://api.github.com/repos/tuanna2704/tms_39/contributors","subscribers_url":"https://api.github.com/repos/tuanna2704/tms_39/subscribers","subscription_url":"https://api.github.com/repos/tuanna2704/tms_39/subscription","commits_url":"https://api.github.com/repos/tuanna2704/tms_39/commits{/sha}","git_commits_url":"https://api.github.com/repos/tuanna2704/tms_39/git/commits{/sha}","comments_url":"https://api.github.com/repos/tuanna2704/tms_39/comments{/number}","issue_comment_url":"https://api.github.com/repos/tuanna2704/tms_39/issues/comments{/number}","contents_url":"https://api.github.com/repos/tuanna2704/tms_39/contents/{+path}","compare_url":"https://api.github.com/repos/tuanna2704/tms_39/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tuanna2704/tms_39/merges","archive_url":"https://api.github.com/repos/tuanna2704/tms_39/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tuanna2704/tms_39/downloads","issues_url":"https://api.github.com/repos/tuanna2704/tms_39/issues{/number}","pulls_url":"https://api.github.com/repos/tuanna2704/tms_39/pulls{/number}","milestones_url":"https://api.github.com/repos/tuanna2704/tms_39/milestones{/number}","notifications_url":"https://api.github.com/repos/tuanna2704/tms_39/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tuanna2704/tms_39/labels{/name}","releases_url":"https://api.github.com/repos/tuanna2704/tms_39/releases{/id}","created_at":"2015-11-04T04:42:22Z","updated_at":"2015-11-04T02:44:50Z","pushed_at":"2015-11-25T02:22:51Z","git_url":"git://github.com/tuanna2704/tms_39.git","ssh_url":"git@github.com:tuanna2704/tms_39.git","clone_url":"https://github.com/tuanna2704/tms_39.git","svn_url":"https://github.com/tuanna2704/tms_39","homepage":null,"size":125,"stargazers_count":0,"watchers_count":0,"language":null,"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":"framgia:develop","ref":"develop","sha":"95b62cab748d00a021b39574661207e9dc15e9d7","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":45510870,"name":"tms_39","full_name":"framgia/tms_39","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/tms_39","description":"Framgia Training Management System (training)","fork":false,"url":"https://api.github.com/repos/framgia/tms_39","forks_url":"https://api.github.com/repos/framgia/tms_39/forks","keys_url":"https://api.github.com/repos/framgia/tms_39/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/tms_39/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/tms_39/teams","hooks_url":"https://api.github.com/repos/framgia/tms_39/hooks","issue_events_url":"https://api.github.com/repos/framgia/tms_39/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/tms_39/events","assignees_url":"https://api.github.com/repos/framgia/tms_39/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/tms_39/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/tms_39/tags","blobs_url":"https://api.github.com/repos/framgia/tms_39/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/tms_39/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/tms_39/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/tms_39/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/tms_39/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/tms_39/languages","stargazers_url":"https://api.github.com/repos/framgia/tms_39/stargazers","contributors_url":"https://api.github.com/repos/framgia/tms_39/contributors","subscribers_url":"https://api.github.com/repos/framgia/tms_39/subscribers","subscription_url":"https://api.github.com/repos/framgia/tms_39/subscription","commits_url":"https://api.github.com/repos/framgia/tms_39/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/tms_39/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/tms_39/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/tms_39/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/tms_39/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/tms_39/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/tms_39/merges","archive_url":"https://api.github.com/repos/framgia/tms_39/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/tms_39/downloads","issues_url":"https://api.github.com/repos/framgia/tms_39/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/tms_39/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/tms_39/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/tms_39/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/tms_39/labels{/name}","releases_url":"https://api.github.com/repos/framgia/tms_39/releases{/id}","created_at":"2015-11-04T02:44:50Z","updated_at":"2015-11-04T02:44:50Z","pushed_at":"2015-11-25T02:22:51Z","git_url":"git://github.com/framgia/tms_39.git","ssh_url":"git@github.com:framgia/tms_39.git","clone_url":"https://github.com/framgia/tms_39.git","svn_url":"https://github.com/framgia/tms_39","homepage":null,"size":144,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":4,"forks":3,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/23"},"html":{"href":"https://github.com/framgia/tms_39/pull/23"},"issue":{"href":"https://api.github.com/repos/framgia/tms_39/issues/23"},"comments":{"href":"https://api.github.com/repos/framgia/tms_39/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/tms_39/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/tms_39/statuses/9ec89ac99356987bd87c730ef35ba75ea1bed132"}}}}