seven1m / onebody

private member portal for churches, built with Ruby on Rails
GNU Affero General Public License v3.0
1.4k stars 284 forks source link

count > 0 should be replaced by exists? #686

Closed lelelelemon closed 7 years ago

lelelelemon commented 7 years ago
onebody/app/models/concerns/person/password.rb:28:          if people.count > 0
onebody/app/models/concerns/person/friend.rb:55:        friends.where('friendships.friend_id' => person.id).count > 0
onebody/app/models/family.rb:38:      elsif Family.where(alternate_barcode_id: record.barcode_id).count > 0
onebody/app/models/family.rb:42:      if Family.where(barcode_id: record.alternate_barcode_id).count > 0
onebody/app/controllers/setups_controller.rb:32:    if Person.count > 0
onebody/app/views/relationships/family_index.html.haml:34:- if @family.people.count > 0
onebody/app/views/people/_pending_updates.haml:1:- if @logged_in.can_update?(@person) and @person.updates.pending.count > 0

could be changed to exists?

seven1m commented 7 years ago

@lelelelemon PRs are welcome. I'll merge if you'll make the PR. Thanks.

lelelelemon commented 7 years ago

No prob, will make the PR soon