{"action":"created","comment":{"url":"https://api.github.com/repos/Hunk13/flashcards/pulls/comments/40203199","id":40203199,"diff_hunk":"@@ -22,10 +22,55 @@ class Card < ActiveRecord::Base\n \n   def check_translation(user_translation)\n     if prepare_text(original_text) == prepare_text(user_translation)\n-      update_attributes(review_date: set_date_after_review)\n+      process_correct_answer\n+      true\n+    else\n+      count_incorrect_answer\n+      false\n     end\n   end\n \n+  def process_correct_answer\n+    increment(:correct_answers) if correct_answers < 5\n+    update_review_date_if_correct\n+  end\n+\n+  def count_incorrect_answer\n+    decrement(:correct_answers) if correct_answers > 0\n+    increment(:incorrect_answers) if incorrect_answers < 3\n+    update_review_date_if_incorrect\n+  end\n+\n+  def update_review_date_if_correct\n+    offset = case correct_answers\n+    when 0\n+      0\n+    when 1","path":"app/models/card.rb","position":28,"original_position":28,"commit_id":"92334f75a345426bde5974bd34be0685d3d1a12f","original_commit_id":"92334f75a345426bde5974bd34be0685d3d1a12f","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Indent `when` as deep as `case`.","created_at":"2015-09-23T13:37:12Z","updated_at":"2015-09-23T13:37:12Z","html_url":"https://github.com/Hunk13/flashcards/pull/16#discussion_r40203199","pull_request_url":"https://api.github.com/repos/Hunk13/flashcards/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/comments/40203199"},"html":{"href":"https://github.com/Hunk13/flashcards/pull/16#discussion_r40203199"},"pull_request":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/Hunk13/flashcards/pulls/16","id":45496224,"html_url":"https://github.com/Hunk13/flashcards/pull/16","diff_url":"https://github.com/Hunk13/flashcards/pull/16.diff","patch_url":"https://github.com/Hunk13/flashcards/pull/16.patch","issue_url":"https://api.github.com/repos/Hunk13/flashcards/issues/16","number":16,"state":"open","locked":false,"title":"business logic","user":{"login":"Hunk13","id":2353427,"avatar_url":"https://avatars.githubusercontent.com/u/2353427?v=3","gravatar_id":"","url":"https://api.github.com/users/Hunk13","html_url":"https://github.com/Hunk13","followers_url":"https://api.github.com/users/Hunk13/followers","following_url":"https://api.github.com/users/Hunk13/following{/other_user}","gists_url":"https://api.github.com/users/Hunk13/gists{/gist_id}","starred_url":"https://api.github.com/users/Hunk13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hunk13/subscriptions","organizations_url":"https://api.github.com/users/Hunk13/orgs","repos_url":"https://api.github.com/users/Hunk13/repos","events_url":"https://api.github.com/users/Hunk13/events{/privacy}","received_events_url":"https://api.github.com/users/Hunk13/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-20T13:20:09Z","updated_at":"2015-09-23T13:37:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89a4a457c7a59284308b048c16d6e0d4165f6d8a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Hunk13/flashcards/pulls/16/commits","review_comments_url":"https://api.github.com/repos/Hunk13/flashcards/pulls/16/comments","review_comment_url":"https://api.github.com/repos/Hunk13/flashcards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Hunk13/flashcards/issues/16/comments","statuses_url":"https://api.github.com/repos/Hunk13/flashcards/statuses/92334f75a345426bde5974bd34be0685d3d1a12f","head":{"label":"Hunk13:thirteenth-lesson","ref":"thirteenth-lesson","sha":"92334f75a345426bde5974bd34be0685d3d1a12f","user":{"login":"Hunk13","id":2353427,"avatar_url":"https://avatars.githubusercontent.com/u/2353427?v=3","gravatar_id":"","url":"https://api.github.com/users/Hunk13","html_url":"https://github.com/Hunk13","followers_url":"https://api.github.com/users/Hunk13/followers","following_url":"https://api.github.com/users/Hunk13/following{/other_user}","gists_url":"https://api.github.com/users/Hunk13/gists{/gist_id}","starred_url":"https://api.github.com/users/Hunk13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hunk13/subscriptions","organizations_url":"https://api.github.com/users/Hunk13/orgs","repos_url":"https://api.github.com/users/Hunk13/repos","events_url":"https://api.github.com/users/Hunk13/events{/privacy}","received_events_url":"https://api.github.com/users/Hunk13/received_events","type":"User","site_admin":false},"repo":{"id":38364862,"name":"flashcards","full_name":"Hunk13/flashcards","owner":{"login":"Hunk13","id":2353427,"avatar_url":"https://avatars.githubusercontent.com/u/2353427?v=3","gravatar_id":"","url":"https://api.github.com/users/Hunk13","html_url":"https://github.com/Hunk13","followers_url":"https://api.github.com/users/Hunk13/followers","following_url":"https://api.github.com/users/Hunk13/following{/other_user}","gists_url":"https://api.github.com/users/Hunk13/gists{/gist_id}","starred_url":"https://api.github.com/users/Hunk13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hunk13/subscriptions","organizations_url":"https://api.github.com/users/Hunk13/orgs","repos_url":"https://api.github.com/users/Hunk13/repos","events_url":"https://api.github.com/users/Hunk13/events{/privacy}","received_events_url":"https://api.github.com/users/Hunk13/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Hunk13/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/Hunk13/flashcards","forks_url":"https://api.github.com/repos/Hunk13/flashcards/forks","keys_url":"https://api.github.com/repos/Hunk13/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hunk13/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hunk13/flashcards/teams","hooks_url":"https://api.github.com/repos/Hunk13/flashcards/hooks","issue_events_url":"https://api.github.com/repos/Hunk13/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/Hunk13/flashcards/events","assignees_url":"https://api.github.com/repos/Hunk13/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/Hunk13/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/Hunk13/flashcards/tags","blobs_url":"https://api.github.com/repos/Hunk13/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hunk13/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hunk13/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hunk13/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hunk13/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/Hunk13/flashcards/languages","stargazers_url":"https://api.github.com/repos/Hunk13/flashcards/stargazers","contributors_url":"https://api.github.com/repos/Hunk13/flashcards/contributors","subscribers_url":"https://api.github.com/repos/Hunk13/flashcards/subscribers","subscription_url":"https://api.github.com/repos/Hunk13/flashcards/subscription","commits_url":"https://api.github.com/repos/Hunk13/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hunk13/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hunk13/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hunk13/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hunk13/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/Hunk13/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hunk13/flashcards/merges","archive_url":"https://api.github.com/repos/Hunk13/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hunk13/flashcards/downloads","issues_url":"https://api.github.com/repos/Hunk13/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/Hunk13/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/Hunk13/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/Hunk13/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hunk13/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/Hunk13/flashcards/releases{/id}","created_at":"2015-07-01T10:22:56Z","updated_at":"2015-09-19T22:18:15Z","pushed_at":"2015-09-23T13:36:32Z","git_url":"git://github.com/Hunk13/flashcards.git","ssh_url":"git@github.com:Hunk13/flashcards.git","clone_url":"https://github.com/Hunk13/flashcards.git","svn_url":"https://github.com/Hunk13/flashcards","homepage":"http://sleepy-reaches-7041.herokuapp.com/","size":928,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Hunk13:master","ref":"master","sha":"a5baabc37b0634c1ed8bd066995bc90504dab36e","user":{"login":"Hunk13","id":2353427,"avatar_url":"https://avatars.githubusercontent.com/u/2353427?v=3","gravatar_id":"","url":"https://api.github.com/users/Hunk13","html_url":"https://github.com/Hunk13","followers_url":"https://api.github.com/users/Hunk13/followers","following_url":"https://api.github.com/users/Hunk13/following{/other_user}","gists_url":"https://api.github.com/users/Hunk13/gists{/gist_id}","starred_url":"https://api.github.com/users/Hunk13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hunk13/subscriptions","organizations_url":"https://api.github.com/users/Hunk13/orgs","repos_url":"https://api.github.com/users/Hunk13/repos","events_url":"https://api.github.com/users/Hunk13/events{/privacy}","received_events_url":"https://api.github.com/users/Hunk13/received_events","type":"User","site_admin":false},"repo":{"id":38364862,"name":"flashcards","full_name":"Hunk13/flashcards","owner":{"login":"Hunk13","id":2353427,"avatar_url":"https://avatars.githubusercontent.com/u/2353427?v=3","gravatar_id":"","url":"https://api.github.com/users/Hunk13","html_url":"https://github.com/Hunk13","followers_url":"https://api.github.com/users/Hunk13/followers","following_url":"https://api.github.com/users/Hunk13/following{/other_user}","gists_url":"https://api.github.com/users/Hunk13/gists{/gist_id}","starred_url":"https://api.github.com/users/Hunk13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hunk13/subscriptions","organizations_url":"https://api.github.com/users/Hunk13/orgs","repos_url":"https://api.github.com/users/Hunk13/repos","events_url":"https://api.github.com/users/Hunk13/events{/privacy}","received_events_url":"https://api.github.com/users/Hunk13/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Hunk13/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/Hunk13/flashcards","forks_url":"https://api.github.com/repos/Hunk13/flashcards/forks","keys_url":"https://api.github.com/repos/Hunk13/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hunk13/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hunk13/flashcards/teams","hooks_url":"https://api.github.com/repos/Hunk13/flashcards/hooks","issue_events_url":"https://api.github.com/repos/Hunk13/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/Hunk13/flashcards/events","assignees_url":"https://api.github.com/repos/Hunk13/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/Hunk13/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/Hunk13/flashcards/tags","blobs_url":"https://api.github.com/repos/Hunk13/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hunk13/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hunk13/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hunk13/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hunk13/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/Hunk13/flashcards/languages","stargazers_url":"https://api.github.com/repos/Hunk13/flashcards/stargazers","contributors_url":"https://api.github.com/repos/Hunk13/flashcards/contributors","subscribers_url":"https://api.github.com/repos/Hunk13/flashcards/subscribers","subscription_url":"https://api.github.com/repos/Hunk13/flashcards/subscription","commits_url":"https://api.github.com/repos/Hunk13/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hunk13/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hunk13/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hunk13/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hunk13/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/Hunk13/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hunk13/flashcards/merges","archive_url":"https://api.github.com/repos/Hunk13/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hunk13/flashcards/downloads","issues_url":"https://api.github.com/repos/Hunk13/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/Hunk13/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/Hunk13/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/Hunk13/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hunk13/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/Hunk13/flashcards/releases{/id}","created_at":"2015-07-01T10:22:56Z","updated_at":"2015-09-19T22:18:15Z","pushed_at":"2015-09-23T13:36:32Z","git_url":"git://github.com/Hunk13/flashcards.git","ssh_url":"git@github.com:Hunk13/flashcards.git","clone_url":"https://github.com/Hunk13/flashcards.git","svn_url":"https://github.com/Hunk13/flashcards","homepage":"http://sleepy-reaches-7041.herokuapp.com/","size":928,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/16"},"html":{"href":"https://github.com/Hunk13/flashcards/pull/16"},"issue":{"href":"https://api.github.com/repos/Hunk13/flashcards/issues/16"},"comments":{"href":"https://api.github.com/repos/Hunk13/flashcards/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/Hunk13/flashcards/statuses/92334f75a345426bde5974bd34be0685d3d1a12f"}}}}