Skip to content

Commit 4666cf1

Browse files
gonzaMsantib
andauthored
Apply suggestions from code review
Co-authored-by: Santiago Bartesaghi <[email protected]>
1 parent 55b9f91 commit 4666cf1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/services/builders/chartkick/repository_distribution_data.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def total_value
4444
end
4545

4646
def total_records
47-
@total_records ||= retrieve_records.count
47+
@total_records ||= retrieve_records.size
4848
end
4949

5050
def success_rate

app/services/builders/chartkick/repository_distribution_data_metrics/review_coverage.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ def value_for_average(entity)
2424
end
2525

2626
def zero_coverage_percentage(records)
27-
return 0 if records.empty?
27+
total_count = records.count
28+
return 0 if total_count.zero?
2829

2930
zero_coverage_count = records.with_zero_coverage.count
30-
total_count = records.count
3131

3232
((zero_coverage_count.to_f / total_count) * 100).round
3333
end

0 commit comments

Comments
 (0)