{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fels_205/pulls/comments/86292381","pull_request_review_id":6956164,"id":86292381,"diff_hunk":"@@ -1,6 +1,34 @@\n class Result < ApplicationRecord\n-  belongs_to :lesson\n+  belongs_to :lession\n   belongs_to :user\n-  belongs_to :word\n-  has_many :choices\n+  has_many :choices, dependent: :destroy\n+  has_many :words, through: :choices\n+\n+  accepts_nested_attributes_for :choices,\n+    reject_if: proc {|attributes| attributes[:answer_id].blank?},\n+    allow_destroy: true\n+\n+  scope :tested, -> user_id, lession_id do\n+    where(lession_id: lession_id, user_id: user_id).limit(1)\n+  end\n+\n+  after_save :create_test\n+\n+  class << self\n+    def get_test user, lesson\n+      Result.find_by user_id: user ,lession_id: lesson\n+    end\n+  end\n+\n+  private\n+    def create_test\n+      words_test = self.lession.category.words.random_words\n+        .limit(self.lession.number_of_words)\n+      words_test.each do |word|\n+        choice = self.choices.build(word_id: word.id)","path":"app/models/result.rb","position":31,"original_position":31,"commit_id":"ffedffbccc0ccef6749c0eb832cc7ccecdb0e08d","original_commit_id":"ffedffbccc0ccef6749c0eb832cc7ccecdb0e08d","user":{"login":"nvtanh","id":5591946,"avatar_url":"https://avatars.githubusercontent.com/u/5591946?v=3","gravatar_id":"","url":"https://api.github.com/users/nvtanh","html_url":"https://github.com/nvtanh","followers_url":"https://api.github.com/users/nvtanh/followers","following_url":"https://api.github.com/users/nvtanh/following{/other_user}","gists_url":"https://api.github.com/users/nvtanh/gists{/gist_id}","starred_url":"https://api.github.com/users/nvtanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nvtanh/subscriptions","organizations_url":"https://api.github.com/users/nvtanh/orgs","repos_url":"https://api.github.com/users/nvtanh/repos","events_url":"https://api.github.com/users/nvtanh/events{/privacy}","received_events_url":"https://api.github.com/users/nvtanh/received_events","type":"User","site_admin":false},"body":"bỏ ngoặc ","created_at":"2016-11-03T06:57:31Z","updated_at":"2016-11-03T06:57:31Z","html_url":"https://github.com/framgia/fels_205/pull/9#discussion_r86292381","pull_request_url":"https://api.github.com/repos/framgia/fels_205/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_205/pulls/comments/86292381"},"html":{"href":"https://github.com/framgia/fels_205/pull/9#discussion_r86292381"},"pull_request":{"href":"https://api.github.com/repos/framgia/fels_205/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fels_205/pulls/9","id":91924458,"html_url":"https://github.com/framgia/fels_205/pull/9","diff_url":"https://github.com/framgia/fels_205/pull/9.diff","patch_url":"https://github.com/framgia/fels_205/pull/9.patch","issue_url":"https://api.github.com/repos/framgia/fels_205/issues/9","number":9,"state":"open","locked":false,"title":"lessons-manager","user":{"login":"phantien133","id":22651625,"avatar_url":"https://avatars.githubusercontent.com/u/22651625?v=3","gravatar_id":"","url":"https://api.github.com/users/phantien133","html_url":"https://github.com/phantien133","followers_url":"https://api.github.com/users/phantien133/followers","following_url":"https://api.github.com/users/phantien133/following{/other_user}","gists_url":"https://api.github.com/users/phantien133/gists{/gist_id}","starred_url":"https://api.github.com/users/phantien133/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phantien133/subscriptions","organizations_url":"https://api.github.com/users/phantien133/orgs","repos_url":"https://api.github.com/users/phantien133/repos","events_url":"https://api.github.com/users/phantien133/events{/privacy}","received_events_url":"https://api.github.com/users/phantien133/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-02T08:10:57Z","updated_at":"2016-11-03T06:58:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6a1968cf5b179f68f75a865fbb8f2c6e6fcc9e4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fels_205/pulls/9/commits","review_comments_url":"https://api.github.com/repos/framgia/fels_205/pulls/9/comments","review_comment_url":"https://api.github.com/repos/framgia/fels_205/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fels_205/issues/9/comments","statuses_url":"https://api.github.com/repos/framgia/fels_205/statuses/ffedffbccc0ccef6749c0eb832cc7ccecdb0e08d","head":{"label":"phantien133:lessons-manager","ref":"lessons-manager","sha":"ffedffbccc0ccef6749c0eb832cc7ccecdb0e08d","user":{"login":"phantien133","id":22651625,"avatar_url":"https://avatars.githubusercontent.com/u/22651625?v=3","gravatar_id":"","url":"https://api.github.com/users/phantien133","html_url":"https://github.com/phantien133","followers_url":"https://api.github.com/users/phantien133/followers","following_url":"https://api.github.com/users/phantien133/following{/other_user}","gists_url":"https://api.github.com/users/phantien133/gists{/gist_id}","starred_url":"https://api.github.com/users/phantien133/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phantien133/subscriptions","organizations_url":"https://api.github.com/users/phantien133/orgs","repos_url":"https://api.github.com/users/phantien133/repos","events_url":"https://api.github.com/users/phantien133/events{/privacy}","received_events_url":"https://api.github.com/users/phantien133/received_events","type":"User","site_admin":false},"repo":{"id":71453142,"name":"fels_205","full_name":"phantien133/fels_205","owner":{"login":"phantien133","id":22651625,"avatar_url":"https://avatars.githubusercontent.com/u/22651625?v=3","gravatar_id":"","url":"https://api.github.com/users/phantien133","html_url":"https://github.com/phantien133","followers_url":"https://api.github.com/users/phantien133/followers","following_url":"https://api.github.com/users/phantien133/following{/other_user}","gists_url":"https://api.github.com/users/phantien133/gists{/gist_id}","starred_url":"https://api.github.com/users/phantien133/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phantien133/subscriptions","organizations_url":"https://api.github.com/users/phantien133/orgs","repos_url":"https://api.github.com/users/phantien133/repos","events_url":"https://api.github.com/users/phantien133/events{/privacy}","received_events_url":"https://api.github.com/users/phantien133/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/phantien133/fels_205","description":"Framgia Edu DN - Training Project","fork":true,"url":"https://api.github.com/repos/phantien133/fels_205","forks_url":"https://api.github.com/repos/phantien133/fels_205/forks","keys_url":"https://api.github.com/repos/phantien133/fels_205/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phantien133/fels_205/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phantien133/fels_205/teams","hooks_url":"https://api.github.com/repos/phantien133/fels_205/hooks","issue_events_url":"https://api.github.com/repos/phantien133/fels_205/issues/events{/number}","events_url":"https://api.github.com/repos/phantien133/fels_205/events","assignees_url":"https://api.github.com/repos/phantien133/fels_205/assignees{/user}","branches_url":"https://api.github.com/repos/phantien133/fels_205/branches{/branch}","tags_url":"https://api.github.com/repos/phantien133/fels_205/tags","blobs_url":"https://api.github.com/repos/phantien133/fels_205/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phantien133/fels_205/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phantien133/fels_205/git/refs{/sha}","trees_url":"https://api.github.com/repos/phantien133/fels_205/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phantien133/fels_205/statuses/{sha}","languages_url":"https://api.github.com/repos/phantien133/fels_205/languages","stargazers_url":"https://api.github.com/repos/phantien133/fels_205/stargazers","contributors_url":"https://api.github.com/repos/phantien133/fels_205/contributors","subscribers_url":"https://api.github.com/repos/phantien133/fels_205/subscribers","subscription_url":"https://api.github.com/repos/phantien133/fels_205/subscription","commits_url":"https://api.github.com/repos/phantien133/fels_205/commits{/sha}","git_commits_url":"https://api.github.com/repos/phantien133/fels_205/git/commits{/sha}","comments_url":"https://api.github.com/repos/phantien133/fels_205/comments{/number}","issue_comment_url":"https://api.github.com/repos/phantien133/fels_205/issues/comments{/number}","contents_url":"https://api.github.com/repos/phantien133/fels_205/contents/{+path}","compare_url":"https://api.github.com/repos/phantien133/fels_205/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phantien133/fels_205/merges","archive_url":"https://api.github.com/repos/phantien133/fels_205/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phantien133/fels_205/downloads","issues_url":"https://api.github.com/repos/phantien133/fels_205/issues{/number}","pulls_url":"https://api.github.com/repos/phantien133/fels_205/pulls{/number}","milestones_url":"https://api.github.com/repos/phantien133/fels_205/milestones{/number}","notifications_url":"https://api.github.com/repos/phantien133/fels_205/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phantien133/fels_205/labels{/name}","releases_url":"https://api.github.com/repos/phantien133/fels_205/releases{/id}","deployments_url":"https://api.github.com/repos/phantien133/fels_205/deployments","created_at":"2016-10-20T10:42:34Z","updated_at":"2016-10-20T02:08:37Z","pushed_at":"2016-11-03T05:36:11Z","git_url":"git://github.com/phantien133/fels_205.git","ssh_url":"git@github.com:phantien133/fels_205.git","clone_url":"https://github.com/phantien133/fels_205.git","svn_url":"https://github.com/phantien133/fels_205","homepage":"","size":91,"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":"86d9717e00891301bbd31deaf3f4f8476ec6ffa4","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":71416312,"name":"fels_205","full_name":"framgia/fels_205","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/fels_205","description":"Framgia Edu DN - Training Project","fork":false,"url":"https://api.github.com/repos/framgia/fels_205","forks_url":"https://api.github.com/repos/framgia/fels_205/forks","keys_url":"https://api.github.com/repos/framgia/fels_205/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fels_205/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fels_205/teams","hooks_url":"https://api.github.com/repos/framgia/fels_205/hooks","issue_events_url":"https://api.github.com/repos/framgia/fels_205/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fels_205/events","assignees_url":"https://api.github.com/repos/framgia/fels_205/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fels_205/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fels_205/tags","blobs_url":"https://api.github.com/repos/framgia/fels_205/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fels_205/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fels_205/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fels_205/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fels_205/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fels_205/languages","stargazers_url":"https://api.github.com/repos/framgia/fels_205/stargazers","contributors_url":"https://api.github.com/repos/framgia/fels_205/contributors","subscribers_url":"https://api.github.com/repos/framgia/fels_205/subscribers","subscription_url":"https://api.github.com/repos/framgia/fels_205/subscription","commits_url":"https://api.github.com/repos/framgia/fels_205/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fels_205/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fels_205/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fels_205/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fels_205/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fels_205/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fels_205/merges","archive_url":"https://api.github.com/repos/framgia/fels_205/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fels_205/downloads","issues_url":"https://api.github.com/repos/framgia/fels_205/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fels_205/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fels_205/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fels_205/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fels_205/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fels_205/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/fels_205/deployments","created_at":"2016-10-20T02:05:29Z","updated_at":"2016-10-20T02:08:37Z","pushed_at":"2016-11-03T05:36:11Z","git_url":"git://github.com/framgia/fels_205.git","ssh_url":"git@github.com:framgia/fels_205.git","clone_url":"https://github.com/framgia/fels_205.git","svn_url":"https://github.com/framgia/fels_205","homepage":"","size":87,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_205/pulls/9"},"html":{"href":"https://github.com/framgia/fels_205/pull/9"},"issue":{"href":"https://api.github.com/repos/framgia/fels_205/issues/9"},"comments":{"href":"https://api.github.com/repos/framgia/fels_205/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fels_205/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fels_205/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fels_205/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fels_205/statuses/ffedffbccc0ccef6749c0eb832cc7ccecdb0e08d"}}}}
{"actor":{"display_login":"nvtanh"}}