{"action":"created","comment":{"url":"https://api.github.com/repos/APA092/flashcards/pulls/comments/94032768","pull_request_review_id":14562719,"id":94032768,"diff_hunk":"@@ -0,0 +1,62 @@\n+class AssessReply\n+  require 'levenshtein'\n+  \n+  def initialize(params)\n+    @timer = params[:timer]\n+    @new_factor = params[:factor]\n+    @attempts = params[:attempts]\n+    @repetition = params[:repetition]\n+    @original_text = params[:original_text]\n+    @users = params[:users]\n+    @pass_score_good = Flashcards::PASS_SCORE_GOOD\n+    @pass_score_average = Flashcards::PASS_SCORE_AVERAGE\n+    @timer_pass_level = Flashcards::PASS_TIMER_SECONDS\n+  end\n+  \n+  def calculate_new_factor\n+    calculate_score\n+    if @q > 2\n+      @new_factor = @new_factor - 0.8 + (0.28 * @q) - (0.02 * @q * @q)\n+      if @new_factor < 1.3\n+        @new_factor = 1.3\n+      end\n+    end\n+  end\n+  \n+  def calculate_score\n+    size = @original_text.strip.size\n+    score = Levenshtein.distance(@original_text.strip, @users.strip)\n+    users_score = score.to_f / size.to_f\n+    if users_score.positive?\n+      @q = 0\n+      if users_score.between?(@pass_score_good, @pass_score_average)\n+        if @timer < @timer_pass_level\n+          @q = 2\n+        else\n+          @q = 1\n+        end\n+      elsif users_score <= @pass_score_good\n+          @q = 3\n+      end\n+    else\n+      if @timer < @timer_pass_level\n+        @q = 5\n+      else\n+        @q = 4\n+      end\n+    end\n+  end\n+  \n+  def set_new_date\n+    calculate_new_factor\n+    if @attempts == 0 or @q < 4\n+      new_repetition = 1\n+    elsif @attempts == 1\n+      new_repetition = 6\n+    else\n+      new_repetition = @repetition*@new_factor.round","path":"app/services/assess_reply.rb","position":57,"original_position":57,"commit_id":"619a7678df498a199ad7f90ec3f8540629f4d44c","original_commit_id":"619a7678df498a199ad7f90ec3f8540629f4d44c","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Surrounding space missing for operator *.","created_at":"2016-12-28T13:30:38Z","updated_at":"2016-12-28T13:30:38Z","html_url":"https://github.com/APA092/flashcards/pull/17#discussion_r94032768","pull_request_url":"https://api.github.com/repos/APA092/flashcards/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/APA092/flashcards/pulls/comments/94032768"},"html":{"href":"https://github.com/APA092/flashcards/pull/17#discussion_r94032768"},"pull_request":{"href":"https://api.github.com/repos/APA092/flashcards/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/APA092/flashcards/pulls/17","id":99453154,"html_url":"https://github.com/APA092/flashcards/pull/17","diff_url":"https://github.com/APA092/flashcards/pull/17.diff","patch_url":"https://github.com/APA092/flashcards/pull/17.patch","issue_url":"https://api.github.com/repos/APA092/flashcards/issues/17","number":17,"state":"open","locked":false,"title":"Task 17","user":{"login":"APA092","id":20084803,"avatar_url":"https://avatars.githubusercontent.com/u/20084803?v=3","gravatar_id":"","url":"https://api.github.com/users/APA092","html_url":"https://github.com/APA092","followers_url":"https://api.github.com/users/APA092/followers","following_url":"https://api.github.com/users/APA092/following{/other_user}","gists_url":"https://api.github.com/users/APA092/gists{/gist_id}","starred_url":"https://api.github.com/users/APA092/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/APA092/subscriptions","organizations_url":"https://api.github.com/users/APA092/orgs","repos_url":"https://api.github.com/users/APA092/repos","events_url":"https://api.github.com/users/APA092/events{/privacy}","received_events_url":"https://api.github.com/users/APA092/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-27T15:02:47Z","updated_at":"2016-12-28T13:30:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93da886241b57413947c060000888d6925c450f9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/APA092/flashcards/pulls/17/commits","review_comments_url":"https://api.github.com/repos/APA092/flashcards/pulls/17/comments","review_comment_url":"https://api.github.com/repos/APA092/flashcards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/APA092/flashcards/issues/17/comments","statuses_url":"https://api.github.com/repos/APA092/flashcards/statuses/619a7678df498a199ad7f90ec3f8540629f4d44c","head":{"label":"APA092:task-17","ref":"task-17","sha":"619a7678df498a199ad7f90ec3f8540629f4d44c","user":{"login":"APA092","id":20084803,"avatar_url":"https://avatars.githubusercontent.com/u/20084803?v=3","gravatar_id":"","url":"https://api.github.com/users/APA092","html_url":"https://github.com/APA092","followers_url":"https://api.github.com/users/APA092/followers","following_url":"https://api.github.com/users/APA092/following{/other_user}","gists_url":"https://api.github.com/users/APA092/gists{/gist_id}","starred_url":"https://api.github.com/users/APA092/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/APA092/subscriptions","organizations_url":"https://api.github.com/users/APA092/orgs","repos_url":"https://api.github.com/users/APA092/repos","events_url":"https://api.github.com/users/APA092/events{/privacy}","received_events_url":"https://api.github.com/users/APA092/received_events","type":"User","site_admin":false},"repo":{"id":72632022,"name":"flashcards","full_name":"APA092/flashcards","owner":{"login":"APA092","id":20084803,"avatar_url":"https://avatars.githubusercontent.com/u/20084803?v=3","gravatar_id":"","url":"https://api.github.com/users/APA092","html_url":"https://github.com/APA092","followers_url":"https://api.github.com/users/APA092/followers","following_url":"https://api.github.com/users/APA092/following{/other_user}","gists_url":"https://api.github.com/users/APA092/gists{/gist_id}","starred_url":"https://api.github.com/users/APA092/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/APA092/subscriptions","organizations_url":"https://api.github.com/users/APA092/orgs","repos_url":"https://api.github.com/users/APA092/repos","events_url":"https://api.github.com/users/APA092/events{/privacy}","received_events_url":"https://api.github.com/users/APA092/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/APA092/flashcards","description":null,"fork":false,"url":"https://api.github.com/repos/APA092/flashcards","forks_url":"https://api.github.com/repos/APA092/flashcards/forks","keys_url":"https://api.github.com/repos/APA092/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/APA092/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/APA092/flashcards/teams","hooks_url":"https://api.github.com/repos/APA092/flashcards/hooks","issue_events_url":"https://api.github.com/repos/APA092/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/APA092/flashcards/events","assignees_url":"https://api.github.com/repos/APA092/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/APA092/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/APA092/flashcards/tags","blobs_url":"https://api.github.com/repos/APA092/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/APA092/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/APA092/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/APA092/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/APA092/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/APA092/flashcards/languages","stargazers_url":"https://api.github.com/repos/APA092/flashcards/stargazers","contributors_url":"https://api.github.com/repos/APA092/flashcards/contributors","subscribers_url":"https://api.github.com/repos/APA092/flashcards/subscribers","subscription_url":"https://api.github.com/repos/APA092/flashcards/subscription","commits_url":"https://api.github.com/repos/APA092/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/APA092/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/APA092/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/APA092/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/APA092/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/APA092/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/APA092/flashcards/merges","archive_url":"https://api.github.com/repos/APA092/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/APA092/flashcards/downloads","issues_url":"https://api.github.com/repos/APA092/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/APA092/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/APA092/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/APA092/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/APA092/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/APA092/flashcards/releases{/id}","deployments_url":"https://api.github.com/repos/APA092/flashcards/deployments","created_at":"2016-11-02T11:09:17Z","updated_at":"2016-11-02T11:20:54Z","pushed_at":"2016-12-28T13:30:22Z","git_url":"git://github.com/APA092/flashcards.git","ssh_url":"git@github.com:APA092/flashcards.git","clone_url":"https://github.com/APA092/flashcards.git","svn_url":"https://github.com/APA092/flashcards","homepage":null,"size":783,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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"}},"base":{"label":"APA092:master","ref":"master","sha":"269715965567a6222dbf4b7260fe6e01e983d2b3","user":{"login":"APA092","id":20084803,"avatar_url":"https://avatars.githubusercontent.com/u/20084803?v=3","gravatar_id":"","url":"https://api.github.com/users/APA092","html_url":"https://github.com/APA092","followers_url":"https://api.github.com/users/APA092/followers","following_url":"https://api.github.com/users/APA092/following{/other_user}","gists_url":"https://api.github.com/users/APA092/gists{/gist_id}","starred_url":"https://api.github.com/users/APA092/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/APA092/subscriptions","organizations_url":"https://api.github.com/users/APA092/orgs","repos_url":"https://api.github.com/users/APA092/repos","events_url":"https://api.github.com/users/APA092/events{/privacy}","received_events_url":"https://api.github.com/users/APA092/received_events","type":"User","site_admin":false},"repo":{"id":72632022,"name":"flashcards","full_name":"APA092/flashcards","owner":{"login":"APA092","id":20084803,"avatar_url":"https://avatars.githubusercontent.com/u/20084803?v=3","gravatar_id":"","url":"https://api.github.com/users/APA092","html_url":"https://github.com/APA092","followers_url":"https://api.github.com/users/APA092/followers","following_url":"https://api.github.com/users/APA092/following{/other_user}","gists_url":"https://api.github.com/users/APA092/gists{/gist_id}","starred_url":"https://api.github.com/users/APA092/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/APA092/subscriptions","organizations_url":"https://api.github.com/users/APA092/orgs","repos_url":"https://api.github.com/users/APA092/repos","events_url":"https://api.github.com/users/APA092/events{/privacy}","received_events_url":"https://api.github.com/users/APA092/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/APA092/flashcards","description":null,"fork":false,"url":"https://api.github.com/repos/APA092/flashcards","forks_url":"https://api.github.com/repos/APA092/flashcards/forks","keys_url":"https://api.github.com/repos/APA092/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/APA092/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/APA092/flashcards/teams","hooks_url":"https://api.github.com/repos/APA092/flashcards/hooks","issue_events_url":"https://api.github.com/repos/APA092/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/APA092/flashcards/events","assignees_url":"https://api.github.com/repos/APA092/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/APA092/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/APA092/flashcards/tags","blobs_url":"https://api.github.com/repos/APA092/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/APA092/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/APA092/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/APA092/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/APA092/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/APA092/flashcards/languages","stargazers_url":"https://api.github.com/repos/APA092/flashcards/stargazers","contributors_url":"https://api.github.com/repos/APA092/flashcards/contributors","subscribers_url":"https://api.github.com/repos/APA092/flashcards/subscribers","subscription_url":"https://api.github.com/repos/APA092/flashcards/subscription","commits_url":"https://api.github.com/repos/APA092/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/APA092/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/APA092/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/APA092/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/APA092/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/APA092/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/APA092/flashcards/merges","archive_url":"https://api.github.com/repos/APA092/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/APA092/flashcards/downloads","issues_url":"https://api.github.com/repos/APA092/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/APA092/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/APA092/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/APA092/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/APA092/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/APA092/flashcards/releases{/id}","deployments_url":"https://api.github.com/repos/APA092/flashcards/deployments","created_at":"2016-11-02T11:09:17Z","updated_at":"2016-11-02T11:20:54Z","pushed_at":"2016-12-28T13:30:22Z","git_url":"git://github.com/APA092/flashcards.git","ssh_url":"git@github.com:APA092/flashcards.git","clone_url":"https://github.com/APA092/flashcards.git","svn_url":"https://github.com/APA092/flashcards","homepage":null,"size":783,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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/APA092/flashcards/pulls/17"},"html":{"href":"https://github.com/APA092/flashcards/pull/17"},"issue":{"href":"https://api.github.com/repos/APA092/flashcards/issues/17"},"comments":{"href":"https://api.github.com/repos/APA092/flashcards/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/APA092/flashcards/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/APA092/flashcards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/APA092/flashcards/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/APA092/flashcards/statuses/619a7678df498a199ad7f90ec3f8540629f4d44c"}}}}
{"actor":{"display_login":"houndci-bot"}}