Update track length in db if empty. Closes #107
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
class TrackController < ApplicationController
|
||||
before_filter :authorize
|
||||
|
||||
def update_length
|
||||
unless params[:track_id].nil?
|
||||
track = Track.find(params[:track_id])
|
||||
unless track.nil? or params[:length].nil?
|
||||
if track.length == nil or track.length.to_i == 0 and params[:length].to_i > 0
|
||||
track.length = params[:length].to_i
|
||||
track.save
|
||||
render :json => { :result => :success }
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
render :json => { :result => :failed }
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user