app/models/gift.rb
# display new deal check box?
# only for open deals - and not for users deals (user is giver or receiver)
display new deal check box.
only for open deals - and not for users deals (user is giver or receiver)
display new deal check box . only for open deals - and not for users deals ( user is giver or receiver )
def show_new_deal_checkbox? (users)
    logger.debug2 "users.class = #{users.class}"
    return false unless [Array, ActiveRecord::Relation::ActiveRecord_Relation_User].index(users.class) and users.size > 0
    return false if User.dummy_users?(users)
    count = 0
    api_gifts.each do |api_gift|
      user = users.find { |user2| user2.provider == api_gift.provider }
      next unless user
      count += 1
      return false if api_gift.user_id_giver == user.user_id
      return false if api_gift.user_id_receiver == user.user_id
    end 
    raise "gift #{id} without api gifts for login user(s)" unless count > 0
    true
  end
def show_new_deal_checkbox? ( users ) logger . debug2 "users.class = #{users.class}" return false unless [ Array , ActiveRecord :: Relation :: ActiveRecord_Relation_User ] . index ( users . class ) and users . size > 0 return false if User . dummy_users? ( users ) count = 0 api_gifts . each do | api_gift | user = users . find { | user2 | user2 . provider == api_gift . provider } next unless user count += 1 return false if api_gift . user_id_giver == user . user_id return false if api_gift . user_id_receiver == user . user_id end raise "gift #{id} without api gifts for login user(s)" unless count > 0 true end
display new deal check box?
display new deal check box?
# each
users
<not_specific>