{"action":"created","comment":{"url":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/comments/243851706","pull_request_review_id":187724159,"id":243851706,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0Mzg1MTcwNg==","diff_hunk":"@@ -20,13 +20,24 @@ class Test < ApplicationRecord\n                                     greater_than_or_equal_to: 0 }\n   validates :title, uniqueness: { scope: :level }\n \n-\n # Использовать тут скоуп by_category?\n   def self.by_category_title(category)\n      self.by_category.order(title: :desc).pluck(:title)\n   end\n-  \n+\n   def self.by_category(category)\n     Test.joins(:category).where(categories: { title: category }).order(title: :desc).pluck(:title)\n   end\n+\n+  def hours_to_pass_test\n+    self.recommended_time.strftime(\"%H\").to_i\n+  end\n+\n+  def minutes_to_pass_test\n+    self.recommended_time.strftime(\"%M\").to_i\n+  end\n+\n+  def time","path":"app/models/test.rb","position":23,"original_position":23,"commit_id":"54b0033cd3ce1c634de23740c460aa348985d5db","original_commit_id":"54b0033cd3ce1c634de23740c460aa348985d5db","user":{"login":"Ellerden","id":7187553,"node_id":"MDQ6VXNlcjcxODc1NTM=","avatar_url":"https://avatars3.githubusercontent.com/u/7187553?v=4","gravatar_id":"","url":"https://api.github.com/users/Ellerden","html_url":"https://github.com/Ellerden","followers_url":"https://api.github.com/users/Ellerden/followers","following_url":"https://api.github.com/users/Ellerden/following{/other_user}","gists_url":"https://api.github.com/users/Ellerden/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellerden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellerden/subscriptions","organizations_url":"https://api.github.com/users/Ellerden/orgs","repos_url":"https://api.github.com/users/Ellerden/repos","events_url":"https://api.github.com/users/Ellerden/events{/privacy}","received_events_url":"https://api.github.com/users/Ellerden/received_events","type":"User","site_admin":false},"body":"я использую это в выводе нескольких вьюх (всех созданных тестов для админа) и для пользователя, показывая время прохождения. Сначала у меня это было в самих вьюхах, но я как раз решила, что лучше всю такую логику убрать в модель. ","created_at":"2018-12-24T18:31:42Z","updated_at":"2018-12-24T18:31:42Z","html_url":"https://github.com/Ellerden/Test-Guru/pull/20#discussion_r243851706","pull_request_url":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/20","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/comments/243851706"},"html":{"href":"https://github.com/Ellerden/Test-Guru/pull/20#discussion_r243851706"},"pull_request":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/20"}},"in_reply_to_id":243845412},"pull_request":{"url":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/20","id":240766082,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwNzY2MDgy","html_url":"https://github.com/Ellerden/Test-Guru/pull/20","diff_url":"https://github.com/Ellerden/Test-Guru/pull/20.diff","patch_url":"https://github.com/Ellerden/Test-Guru/pull/20.patch","issue_url":"https://api.github.com/repos/Ellerden/Test-Guru/issues/20","number":20,"state":"open","locked":false,"title":"Timertasks","user":{"login":"Ellerden","id":7187553,"node_id":"MDQ6VXNlcjcxODc1NTM=","avatar_url":"https://avatars3.githubusercontent.com/u/7187553?v=4","gravatar_id":"","url":"https://api.github.com/users/Ellerden","html_url":"https://github.com/Ellerden","followers_url":"https://api.github.com/users/Ellerden/followers","following_url":"https://api.github.com/users/Ellerden/following{/other_user}","gists_url":"https://api.github.com/users/Ellerden/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellerden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellerden/subscriptions","organizations_url":"https://api.github.com/users/Ellerden/orgs","repos_url":"https://api.github.com/users/Ellerden/repos","events_url":"https://api.github.com/users/Ellerden/events{/privacy}","received_events_url":"https://api.github.com/users/Ellerden/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-24T12:07:19Z","updated_at":"2018-12-24T18:31:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42a59f16be8f4c8ee53484bdbfd8cbb590368d3a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/20/commits","review_comments_url":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/20/comments","review_comment_url":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ellerden/Test-Guru/issues/20/comments","statuses_url":"https://api.github.com/repos/Ellerden/Test-Guru/statuses/54b0033cd3ce1c634de23740c460aa348985d5db","head":{"label":"Ellerden:timertasks","ref":"timertasks","sha":"54b0033cd3ce1c634de23740c460aa348985d5db","user":{"login":"Ellerden","id":7187553,"node_id":"MDQ6VXNlcjcxODc1NTM=","avatar_url":"https://avatars3.githubusercontent.com/u/7187553?v=4","gravatar_id":"","url":"https://api.github.com/users/Ellerden","html_url":"https://github.com/Ellerden","followers_url":"https://api.github.com/users/Ellerden/followers","following_url":"https://api.github.com/users/Ellerden/following{/other_user}","gists_url":"https://api.github.com/users/Ellerden/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellerden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellerden/subscriptions","organizations_url":"https://api.github.com/users/Ellerden/orgs","repos_url":"https://api.github.com/users/Ellerden/repos","events_url":"https://api.github.com/users/Ellerden/events{/privacy}","received_events_url":"https://api.github.com/users/Ellerden/received_events","type":"User","site_admin":false},"repo":{"id":148625091,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg2MjUwOTE=","name":"Test-Guru","full_name":"Ellerden/Test-Guru","private":false,"owner":{"login":"Ellerden","id":7187553,"node_id":"MDQ6VXNlcjcxODc1NTM=","avatar_url":"https://avatars3.githubusercontent.com/u/7187553?v=4","gravatar_id":"","url":"https://api.github.com/users/Ellerden","html_url":"https://github.com/Ellerden","followers_url":"https://api.github.com/users/Ellerden/followers","following_url":"https://api.github.com/users/Ellerden/following{/other_user}","gists_url":"https://api.github.com/users/Ellerden/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellerden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellerden/subscriptions","organizations_url":"https://api.github.com/users/Ellerden/orgs","repos_url":"https://api.github.com/users/Ellerden/repos","events_url":"https://api.github.com/users/Ellerden/events{/privacy}","received_events_url":"https://api.github.com/users/Ellerden/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ellerden/Test-Guru","description":"Project allows people to create and take different tests","fork":false,"url":"https://api.github.com/repos/Ellerden/Test-Guru","forks_url":"https://api.github.com/repos/Ellerden/Test-Guru/forks","keys_url":"https://api.github.com/repos/Ellerden/Test-Guru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ellerden/Test-Guru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ellerden/Test-Guru/teams","hooks_url":"https://api.github.com/repos/Ellerden/Test-Guru/hooks","issue_events_url":"https://api.github.com/repos/Ellerden/Test-Guru/issues/events{/number}","events_url":"https://api.github.com/repos/Ellerden/Test-Guru/events","assignees_url":"https://api.github.com/repos/Ellerden/Test-Guru/assignees{/user}","branches_url":"https://api.github.com/repos/Ellerden/Test-Guru/branches{/branch}","tags_url":"https://api.github.com/repos/Ellerden/Test-Guru/tags","blobs_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ellerden/Test-Guru/statuses/{sha}","languages_url":"https://api.github.com/repos/Ellerden/Test-Guru/languages","stargazers_url":"https://api.github.com/repos/Ellerden/Test-Guru/stargazers","contributors_url":"https://api.github.com/repos/Ellerden/Test-Guru/contributors","subscribers_url":"https://api.github.com/repos/Ellerden/Test-Guru/subscribers","subscription_url":"https://api.github.com/repos/Ellerden/Test-Guru/subscription","commits_url":"https://api.github.com/repos/Ellerden/Test-Guru/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ellerden/Test-Guru/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ellerden/Test-Guru/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ellerden/Test-Guru/contents/{+path}","compare_url":"https://api.github.com/repos/Ellerden/Test-Guru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ellerden/Test-Guru/merges","archive_url":"https://api.github.com/repos/Ellerden/Test-Guru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ellerden/Test-Guru/downloads","issues_url":"https://api.github.com/repos/Ellerden/Test-Guru/issues{/number}","pulls_url":"https://api.github.com/repos/Ellerden/Test-Guru/pulls{/number}","milestones_url":"https://api.github.com/repos/Ellerden/Test-Guru/milestones{/number}","notifications_url":"https://api.github.com/repos/Ellerden/Test-Guru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ellerden/Test-Guru/labels{/name}","releases_url":"https://api.github.com/repos/Ellerden/Test-Guru/releases{/id}","deployments_url":"https://api.github.com/repos/Ellerden/Test-Guru/deployments","created_at":"2018-09-13T11:00:36Z","updated_at":"2018-12-21T17:03:01Z","pushed_at":"2018-12-24T12:07:20Z","git_url":"git://github.com/Ellerden/Test-Guru.git","ssh_url":"git@github.com:Ellerden/Test-Guru.git","clone_url":"https://github.com/Ellerden/Test-Guru.git","svn_url":"https://github.com/Ellerden/Test-Guru","homepage":null,"size":1323,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Ellerden:master","ref":"master","sha":"b35e5def0f5f15d731bf95105bf27933c6342e09","user":{"login":"Ellerden","id":7187553,"node_id":"MDQ6VXNlcjcxODc1NTM=","avatar_url":"https://avatars3.githubusercontent.com/u/7187553?v=4","gravatar_id":"","url":"https://api.github.com/users/Ellerden","html_url":"https://github.com/Ellerden","followers_url":"https://api.github.com/users/Ellerden/followers","following_url":"https://api.github.com/users/Ellerden/following{/other_user}","gists_url":"https://api.github.com/users/Ellerden/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellerden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellerden/subscriptions","organizations_url":"https://api.github.com/users/Ellerden/orgs","repos_url":"https://api.github.com/users/Ellerden/repos","events_url":"https://api.github.com/users/Ellerden/events{/privacy}","received_events_url":"https://api.github.com/users/Ellerden/received_events","type":"User","site_admin":false},"repo":{"id":148625091,"node_id":"MDEwOlJlcG9zaXRvcnkxNDg2MjUwOTE=","name":"Test-Guru","full_name":"Ellerden/Test-Guru","private":false,"owner":{"login":"Ellerden","id":7187553,"node_id":"MDQ6VXNlcjcxODc1NTM=","avatar_url":"https://avatars3.githubusercontent.com/u/7187553?v=4","gravatar_id":"","url":"https://api.github.com/users/Ellerden","html_url":"https://github.com/Ellerden","followers_url":"https://api.github.com/users/Ellerden/followers","following_url":"https://api.github.com/users/Ellerden/following{/other_user}","gists_url":"https://api.github.com/users/Ellerden/gists{/gist_id}","starred_url":"https://api.github.com/users/Ellerden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ellerden/subscriptions","organizations_url":"https://api.github.com/users/Ellerden/orgs","repos_url":"https://api.github.com/users/Ellerden/repos","events_url":"https://api.github.com/users/Ellerden/events{/privacy}","received_events_url":"https://api.github.com/users/Ellerden/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ellerden/Test-Guru","description":"Project allows people to create and take different tests","fork":false,"url":"https://api.github.com/repos/Ellerden/Test-Guru","forks_url":"https://api.github.com/repos/Ellerden/Test-Guru/forks","keys_url":"https://api.github.com/repos/Ellerden/Test-Guru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ellerden/Test-Guru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ellerden/Test-Guru/teams","hooks_url":"https://api.github.com/repos/Ellerden/Test-Guru/hooks","issue_events_url":"https://api.github.com/repos/Ellerden/Test-Guru/issues/events{/number}","events_url":"https://api.github.com/repos/Ellerden/Test-Guru/events","assignees_url":"https://api.github.com/repos/Ellerden/Test-Guru/assignees{/user}","branches_url":"https://api.github.com/repos/Ellerden/Test-Guru/branches{/branch}","tags_url":"https://api.github.com/repos/Ellerden/Test-Guru/tags","blobs_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ellerden/Test-Guru/statuses/{sha}","languages_url":"https://api.github.com/repos/Ellerden/Test-Guru/languages","stargazers_url":"https://api.github.com/repos/Ellerden/Test-Guru/stargazers","contributors_url":"https://api.github.com/repos/Ellerden/Test-Guru/contributors","subscribers_url":"https://api.github.com/repos/Ellerden/Test-Guru/subscribers","subscription_url":"https://api.github.com/repos/Ellerden/Test-Guru/subscription","commits_url":"https://api.github.com/repos/Ellerden/Test-Guru/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ellerden/Test-Guru/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ellerden/Test-Guru/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ellerden/Test-Guru/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ellerden/Test-Guru/contents/{+path}","compare_url":"https://api.github.com/repos/Ellerden/Test-Guru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ellerden/Test-Guru/merges","archive_url":"https://api.github.com/repos/Ellerden/Test-Guru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ellerden/Test-Guru/downloads","issues_url":"https://api.github.com/repos/Ellerden/Test-Guru/issues{/number}","pulls_url":"https://api.github.com/repos/Ellerden/Test-Guru/pulls{/number}","milestones_url":"https://api.github.com/repos/Ellerden/Test-Guru/milestones{/number}","notifications_url":"https://api.github.com/repos/Ellerden/Test-Guru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ellerden/Test-Guru/labels{/name}","releases_url":"https://api.github.com/repos/Ellerden/Test-Guru/releases{/id}","deployments_url":"https://api.github.com/repos/Ellerden/Test-Guru/deployments","created_at":"2018-09-13T11:00:36Z","updated_at":"2018-12-21T17:03:01Z","pushed_at":"2018-12-24T12:07:20Z","git_url":"git://github.com/Ellerden/Test-Guru.git","ssh_url":"git@github.com:Ellerden/Test-Guru.git","clone_url":"https://github.com/Ellerden/Test-Guru.git","svn_url":"https://github.com/Ellerden/Test-Guru","homepage":null,"size":1323,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/20"},"html":{"href":"https://github.com/Ellerden/Test-Guru/pull/20"},"issue":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/issues/20"},"comments":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/Ellerden/Test-Guru/statuses/54b0033cd3ce1c634de23740c460aa348985d5db"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Ellerden"}}