lib/cc/presenters/pull_requests_presenter.rb in codeclimate-services-1.9.2 vs lib/cc/presenters/pull_requests_presenter.rb in codeclimate-services-1.9.3
- old
+ new
@@ -38,44 +38,24 @@
message
end
def success_message
- if both_issue_counts_zero?
- "Code Climate didn't find any new or fixed issues."
+ if @new_count > 0 && @fixed_count > 0
+ "#{@new_count} new #{"issue".pluralize(@new_count)} (#{@fixed_count} fixed)"
+ elsif @new_count <= 0 && @fixed_count > 0
+ "#{@fixed_count} fixed #{"issue".pluralize(@fixed_count)}"
+ elsif @new_count > 0 && @fixed_count <= 0
+ "#{@new_count} new #{"issue".pluralize(@new_count)}"
else
- "Code Climate found #{formatted_issue_counts}."
+ "no new or fixed issues"
end
end
private
- def both_issue_counts_zero?
- issue_counts.all?(&:zero?)
- end
-
- def formatted_fixed_issues
- if @fixed_count > 0
- "#{number_to_delimited(@fixed_count)} fixed #{"issue".pluralize(@fixed_count)}"
- end
- end
-
- def formatted_new_issues
- if @new_count > 0
- "#{number_to_delimited(@new_count)} new #{"issue".pluralize(@new_count)}"
- end
- end
-
- def formatted_issue_counts
- [formatted_new_issues, formatted_fixed_issues].compact.to_sentence
- end
-
def formatted_percent(value)
"%g" % ("%.2f" % value)
- end
-
- def issue_counts
- [@new_count, @fixed_count]
end
end
end
end