vrfs-884: merge conflict fixes
This commit is contained in:
parent
196b895f32
commit
742402dfa2
|
|
@ -2,8 +2,8 @@ module JamRuby
|
|||
class Band < ActiveRecord::Base
|
||||
|
||||
attr_accessible :name, :website, :biography, :city, :state,
|
||||
:country, :original_fpfile_photo, :cropped_fpfile_photo,
|
||||
:cropped_s3_path_photo, :crop_selection_photo, :photo_url
|
||||
:country, :original_fpfile_photo, :cropped_fpfile_photo,
|
||||
:cropped_s3_path_photo, :crop_selection_photo, :photo_url
|
||||
|
||||
attr_accessor :updating_photo
|
||||
|
||||
|
|
@ -101,11 +101,11 @@ module JamRuby
|
|||
|
||||
if hide_private
|
||||
recordings = Recording.joins(:band_recordings)
|
||||
.where(:bands_recordings => {:band_id => "#{band_id}"}, :public => true)
|
||||
.where(:bands_recordings => {:band_id => "#{band_id}"}, :public => true)
|
||||
|
||||
else
|
||||
recordings = Recording.joins(:band_recordings)
|
||||
.where(:bands_recordings => {:band_id => "#{band_id}"})
|
||||
.where(:bands_recordings => {:band_id => "#{band_id}"})
|
||||
end
|
||||
|
||||
return recordings
|
||||
|
|
@ -144,7 +144,7 @@ module JamRuby
|
|||
validate_genres(genres, false)
|
||||
band = Band.new()
|
||||
|
||||
# band update
|
||||
# band update
|
||||
else
|
||||
validate_genres(genres, true)
|
||||
band = Band.find(id)
|
||||
|
|
@ -212,12 +212,12 @@ module JamRuby
|
|||
cropped_s3_path = cropped_fpfile["key"]
|
||||
|
||||
return self.update_attributes(
|
||||
:original_fpfile_photo => original_fpfile,
|
||||
:cropped_fpfile_photo => cropped_fpfile,
|
||||
:cropped_s3_path_photo => cropped_s3_path,
|
||||
:crop_selection_photo => crop_selection,
|
||||
:photo_url => S3Util.url(aws_bucket, cropped_s3_path, :secure => false)
|
||||
)
|
||||
:original_fpfile_photo => original_fpfile,
|
||||
:cropped_fpfile_photo => cropped_fpfile,
|
||||
:cropped_s3_path_photo => cropped_s3_path,
|
||||
:crop_selection_photo => crop_selection,
|
||||
:photo_url => S3Util.url(aws_bucket, cropped_s3_path, :secure => false)
|
||||
)
|
||||
end
|
||||
|
||||
def delete_photo(aws_bucket)
|
||||
|
|
@ -230,13 +230,14 @@ module JamRuby
|
|||
end
|
||||
|
||||
return self.update_attributes(
|
||||
:original_fpfile_photo => nil,
|
||||
:cropped_fpfile_photo => nil,
|
||||
:cropped_s3_path_photo => nil,
|
||||
:crop_selection_photo => nil,
|
||||
:photo_url => nil
|
||||
)
|
||||
:original_fpfile_photo => nil,
|
||||
:cropped_fpfile_photo => nil,
|
||||
:cropped_s3_path_photo => nil,
|
||||
:crop_selection_photo => nil,
|
||||
:photo_url => nil
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def check_lat_lng
|
||||
if (city_changed? || state_changed? || country_changed?)
|
||||
|
|
@ -261,32 +262,32 @@ module JamRuby
|
|||
end
|
||||
|
||||
private
|
||||
def self.validate_genres(genres, is_nil_ok)
|
||||
if is_nil_ok && genres.nil?
|
||||
return
|
||||
end
|
||||
def self.validate_genres(genres, is_nil_ok)
|
||||
if is_nil_ok && genres.nil?
|
||||
return
|
||||
end
|
||||
|
||||
if genres.nil?
|
||||
if genres.nil?
|
||||
raise JamRuby::JamArgumentError, ValidationMessages::GENRE_MINIMUM_NOT_MET
|
||||
else
|
||||
if genres.size < Limits::MIN_GENRES_PER_BAND
|
||||
raise JamRuby::JamArgumentError, ValidationMessages::GENRE_MINIMUM_NOT_MET
|
||||
else
|
||||
if genres.size < Limits::MIN_GENRES_PER_BAND
|
||||
raise JamRuby::JamArgumentError, ValidationMessages::GENRE_MINIMUM_NOT_MET
|
||||
end
|
||||
end
|
||||
|
||||
if genres.size > Limits::MAX_GENRES_PER_BAND
|
||||
raise JamRuby::JamArgumentError, ValidationMessages::GENRE_LIMIT_EXCEEDED
|
||||
end
|
||||
if genres.size > Limits::MAX_GENRES_PER_BAND
|
||||
raise JamRuby::JamArgumentError, ValidationMessages::GENRE_LIMIT_EXCEEDED
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def stringify_photo_info
|
||||
# fpfile comes in as a hash, which is a easy-to-use and validate form. However, we store it as a VARCHAR,
|
||||
# so we need t oconvert it to JSON before storing it (otherwise it gets serialized as a ruby object)
|
||||
# later, when serving this data out to the REST API, we currently just leave it as a string and make a JSON capable
|
||||
# client parse it, because it's very rare when it's needed at all
|
||||
self.original_fpfile_photo = original_fpfile_photo.to_json if !original_fpfile_photo.nil?
|
||||
self.cropped_fpfile_photo = cropped_fpfile_photo.to_json if !cropped_fpfile_photo.nil?
|
||||
self.crop_selection_photo = crop_selection_photo.to_json if !crop_selection_photo.nil?
|
||||
end
|
||||
def stringify_photo_info
|
||||
# fpfile comes in as a hash, which is a easy-to-use and validate form. However, we store it as a VARCHAR,
|
||||
# so we need t oconvert it to JSON before storing it (otherwise it gets serialized as a ruby object)
|
||||
# later, when serving this data out to the REST API, we currently just leave it as a string and make a JSON capable
|
||||
# client parse it, because it's very rare when it's needed at all
|
||||
self.original_fpfile_photo = original_fpfile_photo.to_json if !original_fpfile_photo.nil?
|
||||
self.cropped_fpfile_photo = cropped_fpfile_photo.to_json if !cropped_fpfile_photo.nil?
|
||||
self.crop_selection_photo = crop_selection_photo.to_json if !crop_selection_photo.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue