Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit 62b81a9

Browse files
author
wimo7083
committed
remove print statements when needed and allow default parameter for non-tests
1 parent 0787a6e commit 62b81a9

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

app/controllers/api/v1/resources_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Api
22
module V1
33
class ResourcesController < ApiController
44
before_action :authenticate_user!, except: [:index, :show]
5-
before_filter :set_resource, only: [:show, :update, :destroy]
5+
before_action :set_resource, only: [:show, :update, :destroy]
66

77
def index
88
resources = Resource.with_tags params[:tags]

app/lib/git_hub/issues.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ def initialize
99
@date = GitHubStatistic.last_issue_completed_on
1010
end
1111

12-
def fetch_and_save!
12+
def fetch_and_save!(print_results: true)
1313
get_issues.each do |issue|
1414
git_hub_user = GitHub::Committer.find_or_create_user! issue[:git_hub_user]
15+
git_hub_issue_stat = GitHub::Committer.find_or_create_statistic! issue, issue[:source_type], git_hub_user.id
16+
17+
next unless print_results
1518
p 'git_hub_user:'
1619
p git_hub_user
1720

18-
git_hub_issue_stat = GitHub::Committer.find_or_create_statistic! issue, issue[:source_type], git_hub_user.id
1921
p 'git_hub_issue_stat:'
2022
p git_hub_issue_stat
2123
end

app/lib/git_hub/pull_requests.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ def initialize
99
@date = GitHubStatistic.last_pr_completed_on
1010
end
1111

12-
def fetch_and_save!
12+
def fetch_and_save!(print_results: true)
1313
get_pull_requests.each do |pr|
1414
git_hub_user = GitHub::Committer.find_or_create_user! pr[:git_hub_user]
15+
git_hub_pr_stat = GitHub::Committer.find_or_create_statistic! pr, pr[:source_type], git_hub_user.id
16+
17+
next unless print_results
1518
p 'git_hub_user:'
1619
p git_hub_user
1720

18-
git_hub_pr_stat = GitHub::Committer.find_or_create_statistic! pr, pr[:source_type], git_hub_user.id
1921
p 'git_hub_pr_stat:'
2022
p git_hub_pr_stat
2123
end

lib/tasks/schools_from_yml.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ namespace :schools do
3131
Rails.logger.error message
3232
end
3333

34-
p "Created #{CodeSchool.count} code schools"
35-
p "Created #{Location.count} locations"
34+
# p "Created #{CodeSchool.count} code schools"
35+
# p "Created #{Location.count} locations"
3636
end
3737
end
3838
end

test/models/request_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
class RequestTest < ActiveSupport::TestCase
44
test 'the truth' do
5-
request = create(:request)
6-
p request.requested_mentor
5+
create(:request)
6+
# p request.requested_mentor
77
end
88

99
end

test/requests/git_hub/issues_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_get_issues
3535
end
3636

3737
def test_fetch_and_save
38-
@issue_instance.fetch_and_save!
38+
@issue_instance.fetch_and_save!(print_results: false)
3939

4040
assert GitHubStatistic.for_repository(@backend).count == 28
4141
assert GitHubStatistic.for_repository(@backend).issues.count == 28

test/requests/git_hub/pull_requests_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_get_pull_requests
5151
end
5252

5353
def test_fetch_and_save
54-
@pr_instance.fetch_and_save!
54+
@pr_instance.fetch_and_save!(print_results: false)
5555

5656
assert GitHubStatistic.for_repository(@slash).count == 4
5757
assert GitHubStatistic.for_repository(@slash).pull_requests.count == 2

0 commit comments

Comments
 (0)