# from display name, pick up user id if one user's traces only
@@ -40,8+40,9 @@ class TraceController < ApplicationController
opt[:order] = 'timestamp DESC'
if params[:tag]
opt[:order] = 'timestamp DESC'
if params[:tag]
+ @tag = params[:tag]
conditions[0] += " AND gpx_file_tags.tag = ?"
conditions[0] += " AND gpx_file_tags.tag = ?"
- conditions << params[:tag];
+ conditions << @tag;
end
opt[:conditions] = conditions
end
opt[:conditions] = conditions
@@ -103,11+104,15 @@ class TraceController < ApplicationController
@trace.inserted = false
@trace.user_id = @user.id
@trace.timestamp = Time.now
@trace.inserted = false
@trace.user_id = @user.id
@trace.timestamp = Time.now
+ saved_filename = "/tmp/#{@trace.id}.gpx"
+ # *nix - specific `mv #{filename} /tmp/#{@trace.id}.gpx`
+ File.rename(filename, saved_filename)
+ @trace.tmpname = saved_filename
if @trace.save
logger.info("id is #{@trace.id}")
if @trace.save
logger.info("id is #{@trace.id}")
- File.rename(filename, "/tmp/#{@trace.id}.gpx")
- # *nix - specific `mv #{filename} /tmp/#{@trace.id}.gpx`
flash[:notice] = "Your GPX file has been uploaded and is awaiting insertion in to the database. This will usually happen within half an hour, and an email will be sent to you on completion."
flash[:notice] = "Your GPX file has been uploaded and is awaiting insertion in to the database. This will usually happen within half an hour, and an email will be sent to you on completion."