{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/tms_46/pulls/comments/52865101","id":52865101,"diff_hunk":"@@ -1,12 +1,20 @@\n class UserSubject < ActiveRecord::Base\n   belongs_to :user\n   belongs_to :course_subject\n-  after_update :create_user_task\n+  after_update :create_user_task, :create_user_activity_subject\n \n+  private\n   def create_user_task\n     @course_subject_tasks = course_subject.course_subject_tasks\n     @course_subject_tasks.each do |course_subject_task|\n-      user.user_tasks.create course_subject_task_id: course_subject_task.id\n+      unless user.has_course_subject_task? course_subject_task\n+        user.user_tasks.create course_subject_task: course_subject_task\n+      end\n     end\n   end\n+\n+  def create_user_activity_subject\n+    user.activities.create user_id: user.id, target: course_subject.subject.name,","path":"app/models/user_subject.rb","position":19,"original_position":19,"commit_id":"964544d833d073cd50c30263b8123d5af0d81556","original_commit_id":"964544d833d073cd50c30263b8123d5af0d81556","user":{"login":"hellovietnam93","id":8023606,"avatar_url":"https://avatars.githubusercontent.com/u/8023606?v=3","gravatar_id":"","url":"https://api.github.com/users/hellovietnam93","html_url":"https://github.com/hellovietnam93","followers_url":"https://api.github.com/users/hellovietnam93/followers","following_url":"https://api.github.com/users/hellovietnam93/following{/other_user}","gists_url":"https://api.github.com/users/hellovietnam93/gists{/gist_id}","starred_url":"https://api.github.com/users/hellovietnam93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellovietnam93/subscriptions","organizations_url":"https://api.github.com/users/hellovietnam93/orgs","repos_url":"https://api.github.com/users/hellovietnam93/repos","events_url":"https://api.github.com/users/hellovietnam93/events{/privacy}","received_events_url":"https://api.github.com/users/hellovietnam93/received_events","type":"User","site_admin":false},"body":"user.activities.create user: user, target: course_subject.subject.name,","created_at":"2016-02-15T06:53:52Z","updated_at":"2016-02-15T06:53:52Z","html_url":"https://github.com/framgia/tms_46/pull/33#discussion_r52865101","pull_request_url":"https://api.github.com/repos/framgia/tms_46/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_46/pulls/comments/52865101"},"html":{"href":"https://github.com/framgia/tms_46/pull/33#discussion_r52865101"},"pull_request":{"href":"https://api.github.com/repos/framgia/tms_46/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/tms_46/pulls/33","id":59316286,"html_url":"https://github.com/framgia/tms_46/pull/33","diff_url":"https://github.com/framgia/tms_46/pull/33.diff","patch_url":"https://github.com/framgia/tms_46/pull/33.patch","issue_url":"https://api.github.com/repos/framgia/tms_46/issues/33","number":33,"state":"open","locked":false,"title":"User activities","user":{"login":"vuducluan","id":16602169,"avatar_url":"https://avatars.githubusercontent.com/u/16602169?v=3","gravatar_id":"","url":"https://api.github.com/users/vuducluan","html_url":"https://github.com/vuducluan","followers_url":"https://api.github.com/users/vuducluan/followers","following_url":"https://api.github.com/users/vuducluan/following{/other_user}","gists_url":"https://api.github.com/users/vuducluan/gists{/gist_id}","starred_url":"https://api.github.com/users/vuducluan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuducluan/subscriptions","organizations_url":"https://api.github.com/users/vuducluan/orgs","repos_url":"https://api.github.com/users/vuducluan/repos","events_url":"https://api.github.com/users/vuducluan/events{/privacy}","received_events_url":"https://api.github.com/users/vuducluan/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-15T02:55:16Z","updated_at":"2016-02-15T06:53:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2bdb2ebdacea5004e31d5318940887ba13da6680","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/tms_46/pulls/33/commits","review_comments_url":"https://api.github.com/repos/framgia/tms_46/pulls/33/comments","review_comment_url":"https://api.github.com/repos/framgia/tms_46/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/tms_46/issues/33/comments","statuses_url":"https://api.github.com/repos/framgia/tms_46/statuses/964544d833d073cd50c30263b8123d5af0d81556","head":{"label":"vuducluan:task-52604-user-activities","ref":"task-52604-user-activities","sha":"964544d833d073cd50c30263b8123d5af0d81556","user":{"login":"vuducluan","id":16602169,"avatar_url":"https://avatars.githubusercontent.com/u/16602169?v=3","gravatar_id":"","url":"https://api.github.com/users/vuducluan","html_url":"https://github.com/vuducluan","followers_url":"https://api.github.com/users/vuducluan/followers","following_url":"https://api.github.com/users/vuducluan/following{/other_user}","gists_url":"https://api.github.com/users/vuducluan/gists{/gist_id}","starred_url":"https://api.github.com/users/vuducluan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuducluan/subscriptions","organizations_url":"https://api.github.com/users/vuducluan/orgs","repos_url":"https://api.github.com/users/vuducluan/repos","events_url":"https://api.github.com/users/vuducluan/events{/privacy}","received_events_url":"https://api.github.com/users/vuducluan/received_events","type":"User","site_admin":false},"repo":{"id":50340940,"name":"tms_46","full_name":"vuducluan/tms_46","owner":{"login":"vuducluan","id":16602169,"avatar_url":"https://avatars.githubusercontent.com/u/16602169?v=3","gravatar_id":"","url":"https://api.github.com/users/vuducluan","html_url":"https://github.com/vuducluan","followers_url":"https://api.github.com/users/vuducluan/followers","following_url":"https://api.github.com/users/vuducluan/following{/other_user}","gists_url":"https://api.github.com/users/vuducluan/gists{/gist_id}","starred_url":"https://api.github.com/users/vuducluan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuducluan/subscriptions","organizations_url":"https://api.github.com/users/vuducluan/orgs","repos_url":"https://api.github.com/users/vuducluan/repos","events_url":"https://api.github.com/users/vuducluan/events{/privacy}","received_events_url":"https://api.github.com/users/vuducluan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vuducluan/tms_46","description":"Framgia Training Management System (training)","fork":true,"url":"https://api.github.com/repos/vuducluan/tms_46","forks_url":"https://api.github.com/repos/vuducluan/tms_46/forks","keys_url":"https://api.github.com/repos/vuducluan/tms_46/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vuducluan/tms_46/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vuducluan/tms_46/teams","hooks_url":"https://api.github.com/repos/vuducluan/tms_46/hooks","issue_events_url":"https://api.github.com/repos/vuducluan/tms_46/issues/events{/number}","events_url":"https://api.github.com/repos/vuducluan/tms_46/events","assignees_url":"https://api.github.com/repos/vuducluan/tms_46/assignees{/user}","branches_url":"https://api.github.com/repos/vuducluan/tms_46/branches{/branch}","tags_url":"https://api.github.com/repos/vuducluan/tms_46/tags","blobs_url":"https://api.github.com/repos/vuducluan/tms_46/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vuducluan/tms_46/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vuducluan/tms_46/git/refs{/sha}","trees_url":"https://api.github.com/repos/vuducluan/tms_46/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vuducluan/tms_46/statuses/{sha}","languages_url":"https://api.github.com/repos/vuducluan/tms_46/languages","stargazers_url":"https://api.github.com/repos/vuducluan/tms_46/stargazers","contributors_url":"https://api.github.com/repos/vuducluan/tms_46/contributors","subscribers_url":"https://api.github.com/repos/vuducluan/tms_46/subscribers","subscription_url":"https://api.github.com/repos/vuducluan/tms_46/subscription","commits_url":"https://api.github.com/repos/vuducluan/tms_46/commits{/sha}","git_commits_url":"https://api.github.com/repos/vuducluan/tms_46/git/commits{/sha}","comments_url":"https://api.github.com/repos/vuducluan/tms_46/comments{/number}","issue_comment_url":"https://api.github.com/repos/vuducluan/tms_46/issues/comments{/number}","contents_url":"https://api.github.com/repos/vuducluan/tms_46/contents/{+path}","compare_url":"https://api.github.com/repos/vuducluan/tms_46/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vuducluan/tms_46/merges","archive_url":"https://api.github.com/repos/vuducluan/tms_46/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vuducluan/tms_46/downloads","issues_url":"https://api.github.com/repos/vuducluan/tms_46/issues{/number}","pulls_url":"https://api.github.com/repos/vuducluan/tms_46/pulls{/number}","milestones_url":"https://api.github.com/repos/vuducluan/tms_46/milestones{/number}","notifications_url":"https://api.github.com/repos/vuducluan/tms_46/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vuducluan/tms_46/labels{/name}","releases_url":"https://api.github.com/repos/vuducluan/tms_46/releases{/id}","deployments_url":"https://api.github.com/repos/vuducluan/tms_46/deployments","created_at":"2016-01-25T09:42:13Z","updated_at":"2016-01-25T08:35:56Z","pushed_at":"2016-02-15T06:50:25Z","git_url":"git://github.com/vuducluan/tms_46.git","ssh_url":"git@github.com:vuducluan/tms_46.git","clone_url":"https://github.com/vuducluan/tms_46.git","svn_url":"https://github.com/vuducluan/tms_46","homepage":null,"size":93,"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":"afff0ad0666356e958e655ce6bcf353cb10e921a","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":50337251,"name":"tms_46","full_name":"framgia/tms_46","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_46","description":"Framgia Training Management System (training)","fork":false,"url":"https://api.github.com/repos/framgia/tms_46","forks_url":"https://api.github.com/repos/framgia/tms_46/forks","keys_url":"https://api.github.com/repos/framgia/tms_46/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/tms_46/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/tms_46/teams","hooks_url":"https://api.github.com/repos/framgia/tms_46/hooks","issue_events_url":"https://api.github.com/repos/framgia/tms_46/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/tms_46/events","assignees_url":"https://api.github.com/repos/framgia/tms_46/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/tms_46/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/tms_46/tags","blobs_url":"https://api.github.com/repos/framgia/tms_46/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/tms_46/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/tms_46/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/tms_46/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/tms_46/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/tms_46/languages","stargazers_url":"https://api.github.com/repos/framgia/tms_46/stargazers","contributors_url":"https://api.github.com/repos/framgia/tms_46/contributors","subscribers_url":"https://api.github.com/repos/framgia/tms_46/subscribers","subscription_url":"https://api.github.com/repos/framgia/tms_46/subscription","commits_url":"https://api.github.com/repos/framgia/tms_46/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/tms_46/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/tms_46/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/tms_46/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/tms_46/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/tms_46/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/tms_46/merges","archive_url":"https://api.github.com/repos/framgia/tms_46/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/tms_46/downloads","issues_url":"https://api.github.com/repos/framgia/tms_46/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/tms_46/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/tms_46/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/tms_46/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/tms_46/labels{/name}","releases_url":"https://api.github.com/repos/framgia/tms_46/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/tms_46/deployments","created_at":"2016-01-25T08:35:56Z","updated_at":"2016-01-25T08:35:56Z","pushed_at":"2016-02-15T06:50:26Z","git_url":"git://github.com/framgia/tms_46.git","ssh_url":"git@github.com:framgia/tms_46.git","clone_url":"https://github.com/framgia/tms_46.git","svn_url":"https://github.com/framgia/tms_46","homepage":null,"size":108,"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":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_46/pulls/33"},"html":{"href":"https://github.com/framgia/tms_46/pull/33"},"issue":{"href":"https://api.github.com/repos/framgia/tms_46/issues/33"},"comments":{"href":"https://api.github.com/repos/framgia/tms_46/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/tms_46/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/tms_46/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/tms_46/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/tms_46/statuses/964544d833d073cd50c30263b8123d5af0d81556"}}}}