VRFS-2029 : Fix issue where a nil (instead of false)

is causing claimed_recording not to save properly.
This commit is contained in:
Steven Miers 2014-10-15 17:59:59 -05:00
parent e3dadf9c4b
commit cce9fc1577
2 changed files with 7 additions and 3 deletions

View File

@ -6,6 +6,10 @@ module JamRuby
validates :client_video_source_id, :presence => true
def upload_sign(content_md5)
end
def self.create_from_video_source(video_source, recording)
recorded_video_source = self.new
recorded_video_source.recording = recording

View File

@ -181,7 +181,7 @@ module JamRuby
# Called when a user wants to "claim" a recording. To do this, the user must have been one of the tracks in the recording.
def claim(user, name, description, genre, is_public, upload_to_youtube=false)
upload_to_youtube = !!upload_to_youtube # Correct where nil is borking save
unless self.users.exists?(user)
raise PermissionError, "user was not in this session"
end
@ -306,7 +306,7 @@ module JamRuby
uploads = []
# Uploads now include videos in addition to the tracks.
# This is accomplished using a SQL union via arel, as follows:
# This is accomplished using a SQL UNION query via arel, as follows:
# Select fields from track. Note the reorder, which removes
# the default scope sort as it b0rks the union. Also note the
@ -357,7 +357,7 @@ module JamRuby
# Further joining and criteria for the unioned object:
arel = arel.joins("INNER JOIN (SELECT id as rec_id, all_discarded, duration FROM recordings) recs ON rec_id=recorded_items.recording_id") \
.where('recorded_items.user_id' => user.id) \
.where('recorded_items.fully_uploaded =?', false) \
.where('recorded_items.fully_uploaded = ?', false) \
.where('recorded_items.id > ?', since) \
.where("upload_failures <= #{APP_CONFIG.max_track_upload_failures}") \
.where("duration IS NOT NULL") \