{"action":"created","comment":{"url":"https://api.github.com/repos/odinsy/flashcards/pulls/comments/33859298","id":33859298,"diff_hunk":"@@ -3,10 +3,23 @@ class Card < ActiveRecord::Base\n   validate  :texts_are_different\n   before_validation :set_review_date, on: :create\n \n+  scope :to_repeat, -> { where(\"review_date <= ?\", Date.today) }\n+\n+  def review(user_input)\n+    if prepare_word(user_input) == prepare_word(original_text)\n+      set_review_date\n+      self.save\n+    end\n+  end\n+\n+  def prepare_word(string)\n+    string.mb_chars.downcase.strip\n+  end\n+\n   private\n \n   def texts_are_different\n-    if self.original_text.downcase.strip == self.translated_text.downcase.strip\n+    if prepare_word(self.original_text) == prepare_word(self.translated_text)","path":"app/models/card.rb","position":21,"original_position":21,"commit_id":"083616a11377260dac1fcfd89e4f5935d2709f05","original_commit_id":"083616a11377260dac1fcfd89e4f5935d2709f05","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":"Redundant `self` detected.","created_at":"2015-07-03T12:09:27Z","updated_at":"2015-07-03T12:09:27Z","html_url":"https://github.com/odinsy/flashcards/pull/5#discussion_r33859298","pull_request_url":"https://api.github.com/repos/odinsy/flashcards/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/odinsy/flashcards/pulls/comments/33859298"},"html":{"href":"https://github.com/odinsy/flashcards/pull/5#discussion_r33859298"},"pull_request":{"href":"https://api.github.com/repos/odinsy/flashcards/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/odinsy/flashcards/pulls/5","id":39074296,"html_url":"https://github.com/odinsy/flashcards/pull/5","diff_url":"https://github.com/odinsy/flashcards/pull/5.diff","patch_url":"https://github.com/odinsy/flashcards/pull/5.patch","issue_url":"https://api.github.com/repos/odinsy/flashcards/issues/5","number":5,"state":"open","locked":false,"title":"Fifth task","user":{"login":"odinsy","id":12398444,"avatar_url":"https://avatars.githubusercontent.com/u/12398444?v=3","gravatar_id":"","url":"https://api.github.com/users/odinsy","html_url":"https://github.com/odinsy","followers_url":"https://api.github.com/users/odinsy/followers","following_url":"https://api.github.com/users/odinsy/following{/other_user}","gists_url":"https://api.github.com/users/odinsy/gists{/gist_id}","starred_url":"https://api.github.com/users/odinsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odinsy/subscriptions","organizations_url":"https://api.github.com/users/odinsy/orgs","repos_url":"https://api.github.com/users/odinsy/repos","events_url":"https://api.github.com/users/odinsy/events{/privacy}","received_events_url":"https://api.github.com/users/odinsy/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-02T11:49:28Z","updated_at":"2015-07-03T12:09:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86be1e8c9b8dd4f2d83c83d4a85097aac747d90e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/odinsy/flashcards/pulls/5/commits","review_comments_url":"https://api.github.com/repos/odinsy/flashcards/pulls/5/comments","review_comment_url":"https://api.github.com/repos/odinsy/flashcards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/odinsy/flashcards/issues/5/comments","statuses_url":"https://api.github.com/repos/odinsy/flashcards/statuses/083616a11377260dac1fcfd89e4f5935d2709f05","head":{"label":"odinsy:fifth-task","ref":"fifth-task","sha":"083616a11377260dac1fcfd89e4f5935d2709f05","user":{"login":"odinsy","id":12398444,"avatar_url":"https://avatars.githubusercontent.com/u/12398444?v=3","gravatar_id":"","url":"https://api.github.com/users/odinsy","html_url":"https://github.com/odinsy","followers_url":"https://api.github.com/users/odinsy/followers","following_url":"https://api.github.com/users/odinsy/following{/other_user}","gists_url":"https://api.github.com/users/odinsy/gists{/gist_id}","starred_url":"https://api.github.com/users/odinsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odinsy/subscriptions","organizations_url":"https://api.github.com/users/odinsy/orgs","repos_url":"https://api.github.com/users/odinsy/repos","events_url":"https://api.github.com/users/odinsy/events{/privacy}","received_events_url":"https://api.github.com/users/odinsy/received_events","type":"User","site_admin":false},"repo":{"id":36316663,"name":"flashcards","full_name":"odinsy/flashcards","owner":{"login":"odinsy","id":12398444,"avatar_url":"https://avatars.githubusercontent.com/u/12398444?v=3","gravatar_id":"","url":"https://api.github.com/users/odinsy","html_url":"https://github.com/odinsy","followers_url":"https://api.github.com/users/odinsy/followers","following_url":"https://api.github.com/users/odinsy/following{/other_user}","gists_url":"https://api.github.com/users/odinsy/gists{/gist_id}","starred_url":"https://api.github.com/users/odinsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odinsy/subscriptions","organizations_url":"https://api.github.com/users/odinsy/orgs","repos_url":"https://api.github.com/users/odinsy/repos","events_url":"https://api.github.com/users/odinsy/events{/privacy}","received_events_url":"https://api.github.com/users/odinsy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/odinsy/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/odinsy/flashcards","forks_url":"https://api.github.com/repos/odinsy/flashcards/forks","keys_url":"https://api.github.com/repos/odinsy/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odinsy/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odinsy/flashcards/teams","hooks_url":"https://api.github.com/repos/odinsy/flashcards/hooks","issue_events_url":"https://api.github.com/repos/odinsy/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/odinsy/flashcards/events","assignees_url":"https://api.github.com/repos/odinsy/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/odinsy/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/odinsy/flashcards/tags","blobs_url":"https://api.github.com/repos/odinsy/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odinsy/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odinsy/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/odinsy/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odinsy/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/odinsy/flashcards/languages","stargazers_url":"https://api.github.com/repos/odinsy/flashcards/stargazers","contributors_url":"https://api.github.com/repos/odinsy/flashcards/contributors","subscribers_url":"https://api.github.com/repos/odinsy/flashcards/subscribers","subscription_url":"https://api.github.com/repos/odinsy/flashcards/subscription","commits_url":"https://api.github.com/repos/odinsy/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/odinsy/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/odinsy/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/odinsy/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/odinsy/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/odinsy/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odinsy/flashcards/merges","archive_url":"https://api.github.com/repos/odinsy/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odinsy/flashcards/downloads","issues_url":"https://api.github.com/repos/odinsy/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/odinsy/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/odinsy/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/odinsy/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odinsy/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/odinsy/flashcards/releases{/id}","created_at":"2015-05-26T18:48:22Z","updated_at":"2015-05-27T11:38:00Z","pushed_at":"2015-07-03T12:09:18Z","git_url":"git://github.com/odinsy/flashcards.git","ssh_url":"git@github.com:odinsy/flashcards.git","clone_url":"https://github.com/odinsy/flashcards.git","svn_url":"https://github.com/odinsy/flashcards","homepage":null,"size":440,"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":"odinsy:master","ref":"master","sha":"d69d2a367a1dcdf9fba4e0918b21ad678969cbda","user":{"login":"odinsy","id":12398444,"avatar_url":"https://avatars.githubusercontent.com/u/12398444?v=3","gravatar_id":"","url":"https://api.github.com/users/odinsy","html_url":"https://github.com/odinsy","followers_url":"https://api.github.com/users/odinsy/followers","following_url":"https://api.github.com/users/odinsy/following{/other_user}","gists_url":"https://api.github.com/users/odinsy/gists{/gist_id}","starred_url":"https://api.github.com/users/odinsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odinsy/subscriptions","organizations_url":"https://api.github.com/users/odinsy/orgs","repos_url":"https://api.github.com/users/odinsy/repos","events_url":"https://api.github.com/users/odinsy/events{/privacy}","received_events_url":"https://api.github.com/users/odinsy/received_events","type":"User","site_admin":false},"repo":{"id":36316663,"name":"flashcards","full_name":"odinsy/flashcards","owner":{"login":"odinsy","id":12398444,"avatar_url":"https://avatars.githubusercontent.com/u/12398444?v=3","gravatar_id":"","url":"https://api.github.com/users/odinsy","html_url":"https://github.com/odinsy","followers_url":"https://api.github.com/users/odinsy/followers","following_url":"https://api.github.com/users/odinsy/following{/other_user}","gists_url":"https://api.github.com/users/odinsy/gists{/gist_id}","starred_url":"https://api.github.com/users/odinsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odinsy/subscriptions","organizations_url":"https://api.github.com/users/odinsy/orgs","repos_url":"https://api.github.com/users/odinsy/repos","events_url":"https://api.github.com/users/odinsy/events{/privacy}","received_events_url":"https://api.github.com/users/odinsy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/odinsy/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/odinsy/flashcards","forks_url":"https://api.github.com/repos/odinsy/flashcards/forks","keys_url":"https://api.github.com/repos/odinsy/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odinsy/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odinsy/flashcards/teams","hooks_url":"https://api.github.com/repos/odinsy/flashcards/hooks","issue_events_url":"https://api.github.com/repos/odinsy/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/odinsy/flashcards/events","assignees_url":"https://api.github.com/repos/odinsy/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/odinsy/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/odinsy/flashcards/tags","blobs_url":"https://api.github.com/repos/odinsy/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odinsy/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odinsy/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/odinsy/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odinsy/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/odinsy/flashcards/languages","stargazers_url":"https://api.github.com/repos/odinsy/flashcards/stargazers","contributors_url":"https://api.github.com/repos/odinsy/flashcards/contributors","subscribers_url":"https://api.github.com/repos/odinsy/flashcards/subscribers","subscription_url":"https://api.github.com/repos/odinsy/flashcards/subscription","commits_url":"https://api.github.com/repos/odinsy/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/odinsy/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/odinsy/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/odinsy/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/odinsy/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/odinsy/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odinsy/flashcards/merges","archive_url":"https://api.github.com/repos/odinsy/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odinsy/flashcards/downloads","issues_url":"https://api.github.com/repos/odinsy/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/odinsy/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/odinsy/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/odinsy/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odinsy/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/odinsy/flashcards/releases{/id}","created_at":"2015-05-26T18:48:22Z","updated_at":"2015-05-27T11:38:00Z","pushed_at":"2015-07-03T12:09:18Z","git_url":"git://github.com/odinsy/flashcards.git","ssh_url":"git@github.com:odinsy/flashcards.git","clone_url":"https://github.com/odinsy/flashcards.git","svn_url":"https://github.com/odinsy/flashcards","homepage":null,"size":440,"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/odinsy/flashcards/pulls/5"},"html":{"href":"https://github.com/odinsy/flashcards/pull/5"},"issue":{"href":"https://api.github.com/repos/odinsy/flashcards/issues/5"},"comments":{"href":"https://api.github.com/repos/odinsy/flashcards/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/odinsy/flashcards/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/odinsy/flashcards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/odinsy/flashcards/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/odinsy/flashcards/statuses/083616a11377260dac1fcfd89e4f5935d2709f05"}}}}