app/models/api_gift.rb
# 1 for picture with error url and creator in login_users
# 2 for picture
# 3 for without picture
# used in sort before removing api gift doubles. Used in User.api_gifts sort
1 for picture with error url and creator in login_users
2 for picture
3 for without picture
used in sort before removing api gift doubles.
1 for picture with error url and creator in login_users 2 for picture 3 for without picture used in sort before removing api gift doubles .
def picture_sort (login_users)
    return 3 unless picture?
    return 2 unless api_picture_url_on_error_at
    if user_id_giver and user_id_receiver
      comment = gift.api_comments.find { |c| c.accepted_yn == 'Y' }
      creator = comment.user_id == user_id_giver ? user_id_receiver : user_id_giver
    else
      creator = user_id_giver || user_id_receiver
    end
    return 1 if login_users.find { |user| user.user_id == creator } 
    2
  end
def picture_sort ( login_users ) return 3 unless picture? return 2 unless api_picture_url_on_error_at if user_id_giver and user_id_receiver comment = gift . api_comments . find { | c | c . accepted_yn == 'Y' } creator = comment . user_id == user_id_giver ? user_id_receiver : user_id_giver else creator = user_id_giver || user_id_receiver end return 1 if login_users . find { | user | user . user_id == creator } 2 end
1 for picture with error url and creator in login_users
2 for picture
3 for without picture
used in sort before removing api gift doubles.
1 for picture with error url and creator in login_users 2 for picture 3 for without picture used in sort before removing api gift doubles .
# find picture with error marked url - could be missing privs or maybe picture has been deleted on wall # sort picture created by login user before other pictures # picture created by login user(s)
login_users
<not_specific>