{"action":"created","comment":{"url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/comments/243482126","pull_request_review_id":187264918,"id":243482126,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzQ4MjEyNg==","diff_hunk":"@@ -0,0 +1,30 @@\n+require \"#{Rails.root}/lib/expa_api\"\n+\n+class ExpaApplicationSyncScheduler\n+  def self.call\n+    new.call\n+  end\n+\n+  def call\n+    updated_at = Expa::Application.maximum('updated_at_expa')\n+    updated_at = Date.new(2018, 1, 1) if updated_at.nil?\n+    to = Time.now.change(sec: 0)\n+    total = EXPAAPI::Client.query(\n+      CountApplications,\n+      variables: {\n+        from: updated_at,\n+        to: to\n+      }\n+    ).data.all_opportunity_application.paging.total_pages\n+    page = 1\n+    loop do","path":"app/services/expa_application_sync_scheduler.rb","position":20,"original_position":20,"commit_id":"caa0fa29c2c2e71880d20f69891d45751018a2ec","original_commit_id":"caa0fa29c2c2e71880d20f69891d45751018a2ec","user":{"login":"diegodillenburg","id":2464449,"node_id":"MDQ6VXNlcjI0NjQ0NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/2464449?v=4","gravatar_id":"","url":"https://api.github.com/users/diegodillenburg","html_url":"https://github.com/diegodillenburg","followers_url":"https://api.github.com/users/diegodillenburg/followers","following_url":"https://api.github.com/users/diegodillenburg/following{/other_user}","gists_url":"https://api.github.com/users/diegodillenburg/gists{/gist_id}","starred_url":"https://api.github.com/users/diegodillenburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diegodillenburg/subscriptions","organizations_url":"https://api.github.com/users/diegodillenburg/orgs","repos_url":"https://api.github.com/users/diegodillenburg/repos","events_url":"https://api.github.com/users/diegodillenburg/events{/privacy}","received_events_url":"https://api.github.com/users/diegodillenburg/received_events","type":"User","site_admin":false},"body":"Uma sugestão para refatorar esse loop seria utilizar o iterador `.each`, mais comum na comunidade. Por exemplo:\r\n`(1..total).each do |page|; <code>; end`\r\nAssim também eliminamos a necessidade da atribuição de uma variável auxiliar fora do loop, na linha 19. Mantendo a variável `page` dentro do escopo do loop. Também eliminamos a necessidade de explicitar uma condição de saída.","created_at":"2018-12-21T03:46:18Z","updated_at":"2018-12-21T03:46:18Z","html_url":"https://github.com/AIESEC-no-Brasil/databazi/pull/110#discussion_r243482126","pull_request_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/110","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/comments/243482126"},"html":{"href":"https://github.com/AIESEC-no-Brasil/databazi/pull/110#discussion_r243482126"},"pull_request":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/110"}}},"pull_request":{"url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/110","id":238068588,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4MDY4NTg4","html_url":"https://github.com/AIESEC-no-Brasil/databazi/pull/110","diff_url":"https://github.com/AIESEC-no-Brasil/databazi/pull/110.diff","patch_url":"https://github.com/AIESEC-no-Brasil/databazi/pull/110.patch","issue_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues/110","number":110,"state":"open","locked":false,"title":"Aiesec 149","user":{"login":"biliboss","id":1461583,"node_id":"MDQ6VXNlcjE0NjE1ODM=","avatar_url":"https://avatars3.githubusercontent.com/u/1461583?v=4","gravatar_id":"","url":"https://api.github.com/users/biliboss","html_url":"https://github.com/biliboss","followers_url":"https://api.github.com/users/biliboss/followers","following_url":"https://api.github.com/users/biliboss/following{/other_user}","gists_url":"https://api.github.com/users/biliboss/gists{/gist_id}","starred_url":"https://api.github.com/users/biliboss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biliboss/subscriptions","organizations_url":"https://api.github.com/users/biliboss/orgs","repos_url":"https://api.github.com/users/biliboss/repos","events_url":"https://api.github.com/users/biliboss/events{/privacy}","received_events_url":"https://api.github.com/users/biliboss/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-12T15:02:12Z","updated_at":"2018-12-21T03:46:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b56cbad1783198f383dd97f395889b2a71042783","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/110/commits","review_comments_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/110/comments","review_comment_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues/110/comments","statuses_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/statuses/caa0fa29c2c2e71880d20f69891d45751018a2ec","head":{"label":"AIESEC-no-Brasil:AIESEC-149","ref":"AIESEC-149","sha":"caa0fa29c2c2e71880d20f69891d45751018a2ec","user":{"login":"AIESEC-no-Brasil","id":13731660,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNzMxNjYw","avatar_url":"https://avatars3.githubusercontent.com/u/13731660?v=4","gravatar_id":"","url":"https://api.github.com/users/AIESEC-no-Brasil","html_url":"https://github.com/AIESEC-no-Brasil","followers_url":"https://api.github.com/users/AIESEC-no-Brasil/followers","following_url":"https://api.github.com/users/AIESEC-no-Brasil/following{/other_user}","gists_url":"https://api.github.com/users/AIESEC-no-Brasil/gists{/gist_id}","starred_url":"https://api.github.com/users/AIESEC-no-Brasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AIESEC-no-Brasil/subscriptions","organizations_url":"https://api.github.com/users/AIESEC-no-Brasil/orgs","repos_url":"https://api.github.com/users/AIESEC-no-Brasil/repos","events_url":"https://api.github.com/users/AIESEC-no-Brasil/events{/privacy}","received_events_url":"https://api.github.com/users/AIESEC-no-Brasil/received_events","type":"Organization","site_admin":false},"repo":{"id":141451273,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE0NTEyNzM=","name":"databazi","full_name":"AIESEC-no-Brasil/databazi","private":false,"owner":{"login":"AIESEC-no-Brasil","id":13731660,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNzMxNjYw","avatar_url":"https://avatars3.githubusercontent.com/u/13731660?v=4","gravatar_id":"","url":"https://api.github.com/users/AIESEC-no-Brasil","html_url":"https://github.com/AIESEC-no-Brasil","followers_url":"https://api.github.com/users/AIESEC-no-Brasil/followers","following_url":"https://api.github.com/users/AIESEC-no-Brasil/following{/other_user}","gists_url":"https://api.github.com/users/AIESEC-no-Brasil/gists{/gist_id}","starred_url":"https://api.github.com/users/AIESEC-no-Brasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AIESEC-no-Brasil/subscriptions","organizations_url":"https://api.github.com/users/AIESEC-no-Brasil/orgs","repos_url":"https://api.github.com/users/AIESEC-no-Brasil/repos","events_url":"https://api.github.com/users/AIESEC-no-Brasil/events{/privacy}","received_events_url":"https://api.github.com/users/AIESEC-no-Brasil/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/AIESEC-no-Brasil/databazi","description":null,"fork":false,"url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi","forks_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/forks","keys_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/teams","hooks_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/hooks","issue_events_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues/events{/number}","events_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/events","assignees_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/assignees{/user}","branches_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/branches{/branch}","tags_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/tags","blobs_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/refs{/sha}","trees_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/statuses/{sha}","languages_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/languages","stargazers_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/stargazers","contributors_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/contributors","subscribers_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/subscribers","subscription_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/subscription","commits_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/commits{/sha}","git_commits_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/commits{/sha}","comments_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/comments{/number}","issue_comment_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues/comments{/number}","contents_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/contents/{+path}","compare_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/merges","archive_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/downloads","issues_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues{/number}","pulls_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls{/number}","milestones_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/milestones{/number}","notifications_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/labels{/name}","releases_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/releases{/id}","deployments_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/deployments","created_at":"2018-07-18T15:05:58Z","updated_at":"2018-12-18T17:30:47Z","pushed_at":"2018-12-21T03:28:04Z","git_url":"git://github.com/AIESEC-no-Brasil/databazi.git","ssh_url":"git@github.com:AIESEC-no-Brasil/databazi.git","clone_url":"https://github.com/AIESEC-no-Brasil/databazi.git","svn_url":"https://github.com/AIESEC-no-Brasil/databazi","homepage":null,"size":760,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":6,"open_issues":5,"watchers":3,"default_branch":"staging"}},"base":{"label":"AIESEC-no-Brasil:staging","ref":"staging","sha":"ed05230437b10fbe78f7703a4356982f49a23b6c","user":{"login":"AIESEC-no-Brasil","id":13731660,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNzMxNjYw","avatar_url":"https://avatars3.githubusercontent.com/u/13731660?v=4","gravatar_id":"","url":"https://api.github.com/users/AIESEC-no-Brasil","html_url":"https://github.com/AIESEC-no-Brasil","followers_url":"https://api.github.com/users/AIESEC-no-Brasil/followers","following_url":"https://api.github.com/users/AIESEC-no-Brasil/following{/other_user}","gists_url":"https://api.github.com/users/AIESEC-no-Brasil/gists{/gist_id}","starred_url":"https://api.github.com/users/AIESEC-no-Brasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AIESEC-no-Brasil/subscriptions","organizations_url":"https://api.github.com/users/AIESEC-no-Brasil/orgs","repos_url":"https://api.github.com/users/AIESEC-no-Brasil/repos","events_url":"https://api.github.com/users/AIESEC-no-Brasil/events{/privacy}","received_events_url":"https://api.github.com/users/AIESEC-no-Brasil/received_events","type":"Organization","site_admin":false},"repo":{"id":141451273,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE0NTEyNzM=","name":"databazi","full_name":"AIESEC-no-Brasil/databazi","private":false,"owner":{"login":"AIESEC-no-Brasil","id":13731660,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNzMxNjYw","avatar_url":"https://avatars3.githubusercontent.com/u/13731660?v=4","gravatar_id":"","url":"https://api.github.com/users/AIESEC-no-Brasil","html_url":"https://github.com/AIESEC-no-Brasil","followers_url":"https://api.github.com/users/AIESEC-no-Brasil/followers","following_url":"https://api.github.com/users/AIESEC-no-Brasil/following{/other_user}","gists_url":"https://api.github.com/users/AIESEC-no-Brasil/gists{/gist_id}","starred_url":"https://api.github.com/users/AIESEC-no-Brasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AIESEC-no-Brasil/subscriptions","organizations_url":"https://api.github.com/users/AIESEC-no-Brasil/orgs","repos_url":"https://api.github.com/users/AIESEC-no-Brasil/repos","events_url":"https://api.github.com/users/AIESEC-no-Brasil/events{/privacy}","received_events_url":"https://api.github.com/users/AIESEC-no-Brasil/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/AIESEC-no-Brasil/databazi","description":null,"fork":false,"url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi","forks_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/forks","keys_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/teams","hooks_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/hooks","issue_events_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues/events{/number}","events_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/events","assignees_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/assignees{/user}","branches_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/branches{/branch}","tags_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/tags","blobs_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/refs{/sha}","trees_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/statuses/{sha}","languages_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/languages","stargazers_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/stargazers","contributors_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/contributors","subscribers_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/subscribers","subscription_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/subscription","commits_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/commits{/sha}","git_commits_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/git/commits{/sha}","comments_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/comments{/number}","issue_comment_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues/comments{/number}","contents_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/contents/{+path}","compare_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/merges","archive_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/downloads","issues_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues{/number}","pulls_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls{/number}","milestones_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/milestones{/number}","notifications_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/labels{/name}","releases_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/releases{/id}","deployments_url":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/deployments","created_at":"2018-07-18T15:05:58Z","updated_at":"2018-12-18T17:30:47Z","pushed_at":"2018-12-21T03:28:04Z","git_url":"git://github.com/AIESEC-no-Brasil/databazi.git","ssh_url":"git@github.com:AIESEC-no-Brasil/databazi.git","clone_url":"https://github.com/AIESEC-no-Brasil/databazi.git","svn_url":"https://github.com/AIESEC-no-Brasil/databazi","homepage":null,"size":760,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":6,"open_issues":5,"watchers":3,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/110"},"html":{"href":"https://github.com/AIESEC-no-Brasil/databazi/pull/110"},"issue":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues/110"},"comments":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/issues/110/comments"},"review_comments":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/110/comments"},"review_comment":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/pulls/110/commits"},"statuses":{"href":"https://api.github.com/repos/AIESEC-no-Brasil/databazi/statuses/caa0fa29c2c2e71880d20f69891d45751018a2ec"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"diegodillenburg"}}