]> git.openstreetmap.org Git - rails.git/commitdiff
Include tags in GPX success and failure mails. Closes #480.
authorTom Hughes <tom@compton.nu>
Sun, 27 Apr 2008 12:18:19 +0000 (12:18 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 27 Apr 2008 12:18:19 +0000 (12:18 +0000)
app/models/notifier.rb
app/views/notifier/_gpx_description.rhtml [new file with mode: 0644]
app/views/notifier/gpx_failure.rhtml
app/views/notifier/gpx_success.rhtml
lib/daemons/gpx_import.rb

index b9b81a8893d53c354538c68b55f249f00270be42..84d097341c8dee7cd61162a5337fddef436386a9 100644 (file)
@@ -35,6 +35,8 @@ class Notifier < ActionMailer::Base
     headers "Auto-Submitted" => "auto-generated"
     body :trace_name => trace.name,
          :trace_points => trace.size,
+         :trace_description => trace.description,
+         :trace_tags => trace.tags,
          :possible_points => possible_points
   end
 
@@ -44,6 +46,8 @@ class Notifier < ActionMailer::Base
     subject "[OpenStreetMap] GPX Import failure"
     headers "Auto-Submitted" => "auto-generated"
     body :trace_name => trace.name,
+         :trace_description => trace.description,
+         :trace_tags => trace.tags,
          :error => error
   end
   
diff --git a/app/views/notifier/_gpx_description.rhtml b/app/views/notifier/_gpx_description.rhtml
new file mode 100644 (file)
index 0000000..b31c774
--- /dev/null
@@ -0,0 +1,14 @@
+Hi,
+
+It looks like your GPX file
+
+  <%= @trace_name %>
+
+with the description 
+
+  <%= @trace_description %>
+<% if @trace_tags.length>0 %>
+and the following tags:
+<% @trace_tags.each do |tag| %>
+  <%= tag.tag.rstrip %><% end %><% else %>
+and no tags.<% end %>
index 2a16bc49e880af046f164289bec03134d5f3a280..7035e45d180318432613f4ff35f0a204d42a2b26 100644 (file)
@@ -1,9 +1,4 @@
-Hi,
-
-It looks like your GPX file
-
-  <%= @trace_name %>
-
+<%= render :partial => "gpx_description" %>
 failed to import. Here's the error:
 
   <%= @error %>
index ae05bb83b2b9c41986b858262b725a58421a2ab3..2613d742971336e990a8f472ef214c79bd81d8ee 100644 (file)
@@ -1,8 +1,3 @@
-Hi,
-
-It looks like your GPX file
-
-  <%= @trace_name %>
-
+<%= render :partial => "gpx_description" %>
 loaded successfully with <%= @trace_points %> out of a possible
 <%= @possible_points %> points.
index 07f4cd6a4c4e8fade28e1cf9c0aec65198d389f4..e24dc1ad5347e43b141ad9f69131a7ad53a852cc 100755 (executable)
@@ -23,14 +23,14 @@ while(true) do
       if gpx.actual_points > 0
         Notifier::deliver_gpx_success(trace, gpx.actual_points)
       else
-        trace.destroy
         Notifier::deliver_gpx_failure(trace, '0 points parsed ok. Do they all have lat,lng,alt,timestamp?')
+        trace.destroy
       end
     rescue Exception => ex
       logger.info ex.to_s
       ex.backtrace.each {|l| logger.info l }
-      trace.destroy
       Notifier::deliver_gpx_failure(trace, ex.to_s + "\n" + ex.backtrace.join("\n"))
+      trace.destroy
     end
 
     Signal.trap("TERM", "DEFAULT")