{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fts_52/pulls/comments/54683015","id":54683015,"diff_hunk":"@@ -0,0 +1,26 @@\n+module Exams\n+  class ExamsService\n+    def initialize exam\n+      @exam = exam\n+    end\n+\n+    def change_status params\n+      @exam.update_attributes time_start: Time.now if @exam.time_start.nil?\n+      @exam.update_attributes status: Settings.exams.status.started if @exam.unstart?\n+      @exam.update_attributes status: Settings.exams.status.inprogress if\n+        params[:save_exam].present?\n+      @exam.update_attributes status: Settings.exams.status.uncheck if\n+        params[:finish_exam].present?\n+    end\n+\n+    def check_results\n+      correct_num = 0\n+      @exam.results.each do |result|\n+        correct = result.check_correct\n+        correct_num += 1 if correct\n+        result.update_attributes correct: correct","path":"app/services/exams/exams_service.rb","position":21,"original_position":21,"commit_id":"6ef9219d43b8a5857847696585bbd9506b8683c6","original_commit_id":"6ef9219d43b8a5857847696585bbd9506b8683c6","user":{"login":"dieunb","id":2122175,"avatar_url":"https://avatars.githubusercontent.com/u/2122175?v=3","gravatar_id":"","url":"https://api.github.com/users/dieunb","html_url":"https://github.com/dieunb","followers_url":"https://api.github.com/users/dieunb/followers","following_url":"https://api.github.com/users/dieunb/following{/other_user}","gists_url":"https://api.github.com/users/dieunb/gists{/gist_id}","starred_url":"https://api.github.com/users/dieunb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dieunb/subscriptions","organizations_url":"https://api.github.com/users/dieunb/orgs","repos_url":"https://api.github.com/users/dieunb/repos","events_url":"https://api.github.com/users/dieunb/events{/privacy}","received_events_url":"https://api.github.com/users/dieunb/received_events","type":"User","site_admin":false},"body":"Cái này bị hit vào database rất nhiều lần.","created_at":"2016-03-02T06:01:33Z","updated_at":"2016-03-02T06:01:33Z","html_url":"https://github.com/framgia/fts_52/pull/13#discussion_r54683015","pull_request_url":"https://api.github.com/repos/framgia/fts_52/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/framgia/fts_52/pulls/comments/54683015"},"html":{"href":"https://github.com/framgia/fts_52/pull/13#discussion_r54683015"},"pull_request":{"href":"https://api.github.com/repos/framgia/fts_52/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fts_52/pulls/13","id":61348496,"html_url":"https://github.com/framgia/fts_52/pull/13","diff_url":"https://github.com/framgia/fts_52/pull/13.diff","patch_url":"https://github.com/framgia/fts_52/pull/13.patch","issue_url":"https://api.github.com/repos/framgia/fts_52/issues/13","number":13,"state":"open","locked":false,"title":"refs #54623 take and retake exam","user":{"login":"NeverSmileK57CLC","id":10071629,"avatar_url":"https://avatars.githubusercontent.com/u/10071629?v=3","gravatar_id":"","url":"https://api.github.com/users/NeverSmileK57CLC","html_url":"https://github.com/NeverSmileK57CLC","followers_url":"https://api.github.com/users/NeverSmileK57CLC/followers","following_url":"https://api.github.com/users/NeverSmileK57CLC/following{/other_user}","gists_url":"https://api.github.com/users/NeverSmileK57CLC/gists{/gist_id}","starred_url":"https://api.github.com/users/NeverSmileK57CLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeverSmileK57CLC/subscriptions","organizations_url":"https://api.github.com/users/NeverSmileK57CLC/orgs","repos_url":"https://api.github.com/users/NeverSmileK57CLC/repos","events_url":"https://api.github.com/users/NeverSmileK57CLC/events{/privacy}","received_events_url":"https://api.github.com/users/NeverSmileK57CLC/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-02T04:05:02Z","updated_at":"2016-03-02T06:01:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9d3f362526cc0140711320e8f5a8815dc3a1956e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fts_52/pulls/13/commits","review_comments_url":"https://api.github.com/repos/framgia/fts_52/pulls/13/comments","review_comment_url":"https://api.github.com/repos/framgia/fts_52/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fts_52/issues/13/comments","statuses_url":"https://api.github.com/repos/framgia/fts_52/statuses/6ef9219d43b8a5857847696585bbd9506b8683c6","head":{"label":"NeverSmileK57CLC:task/54623_take_and_retake_exam","ref":"task/54623_take_and_retake_exam","sha":"6ef9219d43b8a5857847696585bbd9506b8683c6","user":{"login":"NeverSmileK57CLC","id":10071629,"avatar_url":"https://avatars.githubusercontent.com/u/10071629?v=3","gravatar_id":"","url":"https://api.github.com/users/NeverSmileK57CLC","html_url":"https://github.com/NeverSmileK57CLC","followers_url":"https://api.github.com/users/NeverSmileK57CLC/followers","following_url":"https://api.github.com/users/NeverSmileK57CLC/following{/other_user}","gists_url":"https://api.github.com/users/NeverSmileK57CLC/gists{/gist_id}","starred_url":"https://api.github.com/users/NeverSmileK57CLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeverSmileK57CLC/subscriptions","organizations_url":"https://api.github.com/users/NeverSmileK57CLC/orgs","repos_url":"https://api.github.com/users/NeverSmileK57CLC/repos","events_url":"https://api.github.com/users/NeverSmileK57CLC/events{/privacy}","received_events_url":"https://api.github.com/users/NeverSmileK57CLC/received_events","type":"User","site_admin":false},"repo":{"id":52252395,"name":"fts_52","full_name":"NeverSmileK57CLC/fts_52","owner":{"login":"NeverSmileK57CLC","id":10071629,"avatar_url":"https://avatars.githubusercontent.com/u/10071629?v=3","gravatar_id":"","url":"https://api.github.com/users/NeverSmileK57CLC","html_url":"https://github.com/NeverSmileK57CLC","followers_url":"https://api.github.com/users/NeverSmileK57CLC/followers","following_url":"https://api.github.com/users/NeverSmileK57CLC/following{/other_user}","gists_url":"https://api.github.com/users/NeverSmileK57CLC/gists{/gist_id}","starred_url":"https://api.github.com/users/NeverSmileK57CLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeverSmileK57CLC/subscriptions","organizations_url":"https://api.github.com/users/NeverSmileK57CLC/orgs","repos_url":"https://api.github.com/users/NeverSmileK57CLC/repos","events_url":"https://api.github.com/users/NeverSmileK57CLC/events{/privacy}","received_events_url":"https://api.github.com/users/NeverSmileK57CLC/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NeverSmileK57CLC/fts_52","description":"Framgia Test System (training)","fork":true,"url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52","forks_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/forks","keys_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/teams","hooks_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/hooks","issue_events_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/issues/events{/number}","events_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/events","assignees_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/assignees{/user}","branches_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/branches{/branch}","tags_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/tags","blobs_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/git/refs{/sha}","trees_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/statuses/{sha}","languages_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/languages","stargazers_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/stargazers","contributors_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/contributors","subscribers_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/subscribers","subscription_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/subscription","commits_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/commits{/sha}","git_commits_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/git/commits{/sha}","comments_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/comments{/number}","issue_comment_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/issues/comments{/number}","contents_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/contents/{+path}","compare_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/merges","archive_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/downloads","issues_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/issues{/number}","pulls_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/pulls{/number}","milestones_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/milestones{/number}","notifications_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/labels{/name}","releases_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/releases{/id}","deployments_url":"https://api.github.com/repos/NeverSmileK57CLC/fts_52/deployments","created_at":"2016-02-22T06:36:38Z","updated_at":"2016-02-22T06:36:52Z","pushed_at":"2016-03-02T05:49:50Z","git_url":"git://github.com/NeverSmileK57CLC/fts_52.git","ssh_url":"git@github.com:NeverSmileK57CLC/fts_52.git","clone_url":"https://github.com/NeverSmileK57CLC/fts_52.git","svn_url":"https://github.com/NeverSmileK57CLC/fts_52","homepage":null,"size":73,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"framgia:develop","ref":"develop","sha":"e386ec690a53e68f1c56345eec109d5ec75c4133","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":52242186,"name":"fts_52","full_name":"framgia/fts_52","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/fts_52","description":"Framgia Test System (training)","fork":false,"url":"https://api.github.com/repos/framgia/fts_52","forks_url":"https://api.github.com/repos/framgia/fts_52/forks","keys_url":"https://api.github.com/repos/framgia/fts_52/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fts_52/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fts_52/teams","hooks_url":"https://api.github.com/repos/framgia/fts_52/hooks","issue_events_url":"https://api.github.com/repos/framgia/fts_52/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fts_52/events","assignees_url":"https://api.github.com/repos/framgia/fts_52/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fts_52/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fts_52/tags","blobs_url":"https://api.github.com/repos/framgia/fts_52/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fts_52/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fts_52/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fts_52/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fts_52/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fts_52/languages","stargazers_url":"https://api.github.com/repos/framgia/fts_52/stargazers","contributors_url":"https://api.github.com/repos/framgia/fts_52/contributors","subscribers_url":"https://api.github.com/repos/framgia/fts_52/subscribers","subscription_url":"https://api.github.com/repos/framgia/fts_52/subscription","commits_url":"https://api.github.com/repos/framgia/fts_52/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fts_52/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fts_52/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fts_52/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fts_52/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fts_52/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fts_52/merges","archive_url":"https://api.github.com/repos/framgia/fts_52/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fts_52/downloads","issues_url":"https://api.github.com/repos/framgia/fts_52/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fts_52/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fts_52/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fts_52/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fts_52/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fts_52/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/fts_52/deployments","created_at":"2016-02-22T02:47:08Z","updated_at":"2016-02-22T02:47:08Z","pushed_at":"2016-03-02T05:49:50Z","git_url":"git://github.com/framgia/fts_52.git","ssh_url":"git@github.com:framgia/fts_52.git","clone_url":"https://github.com/framgia/fts_52.git","svn_url":"https://github.com/framgia/fts_52","homepage":null,"size":68,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fts_52/pulls/13"},"html":{"href":"https://github.com/framgia/fts_52/pull/13"},"issue":{"href":"https://api.github.com/repos/framgia/fts_52/issues/13"},"comments":{"href":"https://api.github.com/repos/framgia/fts_52/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fts_52/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fts_52/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fts_52/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fts_52/statuses/6ef9219d43b8a5857847696585bbd9506b8683c6"}}}}