{"action":"created","comment":{"url":"https://api.github.com/repos/Hunk13/flashcards/pulls/comments/42166954","id":42166954,"diff_hunk":"@@ -1,56 +1,49 @@\n class SuperMemo2\n-  # Split the knowledge into smallest possible items.\n-  # With all items associate an E-Factor equal to 2.5.\n+  class << self\n+    def quality_helper(attempt, seconds, subtrahend)\n+      total = 8 * attempt + seconds\n+      if total < 16\n+        5 - subtrahend\n+      elsif total < 24\n+        4 - subtrahend\n+      else\n+        3 - subtrahend\n+      end\n+    end\n \n-  # If the quality response was lower than 3 then start repetitions\n-  # for the item from the beginning without changing the E-Factor\n-  # (i.e. use intervals I(1), I(2) etc. as if the item was memorized anew).\n-  # After each repetition session of a given day repeat again all items\n-  # that scored below four in the quality assessment. Continue the repetitions\n-  # until all of these items score at least four.\n-  def self.repetition(e_factor, interval, quality, repetitions, review_date)\n-    repetitions = number_of_repetitions(repetitions, quality)\n-    {\n-      e_factor: calculate_efactor(e_factor, quality),\n-      interval: repetition_interval(repetitions, interval, e_factor).days,\n-      quality: quality,\n-      repetitions: repetitions + 1,\n-      review_date: Time.zone.now + interval\n-    }\n-  end\n+    def set_quality(attempt, typos, seconds)\n+      if typos < 3\n+        quality_helper(attempt, seconds, 0)\n+      else\n+        quality_helper(attempt, seconds, 3)\n+      end\n+    end\n \n-  # Repeat items using the following intervals:\n-  # I(1):=1\n-  # I(2):=6\n-  # for n>2: I(n):=I(n-1)*EF\n-  # where:\n-  # I(n) - inter-repetition interval after the n-th repetition (in days),\n-  # EF - E-Factor of a given item\n-  # If interval is a fraction, round it up to the nearest integer.\n-  def self.repetition_interval(repetitions, interval, e_factor)\n-    case repetitions\n-    when 0 then 1\n-    when 1 then 6\n-    else\n-      (interval * e_factor).round\n+    def repetition_interval(repetitions, interval, e_factor)\n+      case repetitions\n+      when 0 then 1\n+      when 1 then 6\n+      else\n+        (interval * e_factor).ceil\n+      end\n     end\n-  end\n \n-  # After each repetition modify the E-Factor of the recently repeated\n-  # item according to the formula:\n-  # EF':=EF+(0.1-(5-q)*(0.08+(5-q)*0.02))\n-  # where:\n-  # EF' - new value of the E-Factor,\n-  # EF - old value of the E-Factor,\n-  # q - quality of the response in the 0-5 grade scale.\n-  # If EF is less than 1.3 then let EF be 1.3.\n-  def self.calculate_efactor(e_factor, quality)\n-    ef = e_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))\n-    [ef, 1.3].max\n-  end\n+    def calculate_efactor(e_factor, quality)\n+      e_factor = e_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))","path":"app/services/super_memo2.rb","position":77,"original_position":77,"commit_id":"7529e35f22b69ccce84f575c6683ef26c96cfc98","original_commit_id":"7529e35f22b69ccce84f575c6683ef26c96cfc98","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":"Line is too long. [81/80]","created_at":"2015-10-15T19:10:22Z","updated_at":"2015-10-15T19:10:22Z","html_url":"https://github.com/Hunk13/flashcards/pull/27#discussion_r42166954","pull_request_url":"https://api.github.com/repos/Hunk13/flashcards/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/comments/42166954"},"html":{"href":"https://github.com/Hunk13/flashcards/pull/27#discussion_r42166954"},"pull_request":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/Hunk13/flashcards/pulls/27","id":47666004,"html_url":"https://github.com/Hunk13/flashcards/pull/27","diff_url":"https://github.com/Hunk13/flashcards/pull/27.diff","patch_url":"https://github.com/Hunk13/flashcards/pull/27.patch","issue_url":"https://api.github.com/repos/Hunk13/flashcards/issues/27","number":27,"state":"open","locked":false,"title":"nineteenth-lesson","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-10-14T14:25:46Z","updated_at":"2015-10-15T19:10:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77f0ed36d7a9a9b75bb80e4e77ce2e3116361905","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Hunk13/flashcards/pulls/27/commits","review_comments_url":"https://api.github.com/repos/Hunk13/flashcards/pulls/27/comments","review_comment_url":"https://api.github.com/repos/Hunk13/flashcards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Hunk13/flashcards/issues/27/comments","statuses_url":"https://api.github.com/repos/Hunk13/flashcards/statuses/7529e35f22b69ccce84f575c6683ef26c96cfc98","head":{"label":"Hunk13:nineteenth-lesson","ref":"nineteenth-lesson","sha":"7529e35f22b69ccce84f575c6683ef26c96cfc98","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-10-15T19:10:12Z","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":1152,"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":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"Hunk13:master","ref":"master","sha":"fa206908280a7e5c6e9f4b51bd7a7bd84e49f15c","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-10-15T19:10:12Z","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":1152,"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":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/27"},"html":{"href":"https://github.com/Hunk13/flashcards/pull/27"},"issue":{"href":"https://api.github.com/repos/Hunk13/flashcards/issues/27"},"comments":{"href":"https://api.github.com/repos/Hunk13/flashcards/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Hunk13/flashcards/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/Hunk13/flashcards/statuses/7529e35f22b69ccce84f575c6683ef26c96cfc98"}}}}