Patch #26728

count > 0 vs exists?

Added by jwjw yy about 2 years ago. Updated over 1 year ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Code cleanup/refactoring
Target version:-

Description

redmine/app/models/project.rb:671:      if versions.count > 0
redmine/app/views/imports/show.html.erb:3:<% if @import.saved_items.count > 0 %>
redmine/app/views/imports/show.html.erb:15:<% if @import.unsaved_items.count > 0 %>

could be

redmine/app/models/project.rb:671:      if versions.exists?
redmine/app/views/imports/show.html.erb:3:<% if @import.saved_items.exists? %>
redmine/app/views/imports/show.html.erb:15:<% if @import.unsaved_items.exists?%>

Related issues

Related to Redmine - Patch #24839: Minor performance improvement - Replace count by exists? Closed

History

#1 Updated by Toshi MARUYAMA about 2 years ago

  • Category set to Code cleanup/refactoring
  • Status changed from New to Needs feedback

Please post by patch.

#2 Updated by Toshi MARUYAMA about 2 years ago

And please describe why this change is effective.

#3 Updated by Toshi MARUYAMA about 2 years ago

Toshi MARUYAMA wrote:

Please post by patch.

Please post by attachment patch file.

#4 Updated by Go MAEDA over 1 year ago

  • Related to Patch #24839: Minor performance improvement - Replace count by exists? added

#5 Updated by Go MAEDA over 1 year ago

  • Status changed from Needs feedback to Closed

We have decided not to use exists? there. Please see #24839#note-1 and #24839#note-3.

Also available in: Atom PDF