~ fix
authorAlexandre Bertails <bertails@w3.org>
Thu, 25 Aug 2011 17:57:34 -0400
changeset 103 a6c74d8fc61a
parent 102 ab69792e8bc3
child 104 ed1fb6a6036f
~ fix
src/main/resources/templates/gpx.ssp
src/main/scala/Main.scala
--- a/src/main/resources/templates/gpx.ssp	Thu Aug 25 17:46:38 2011 -0400
+++ b/src/main/resources/templates/gpx.ssp	Thu Aug 25 17:57:34 2011 -0400
@@ -3,13 +3,12 @@
 <gpx creator="BuddyRunner.com" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
 
 <metadata>
-	<time>2011-08-10T06:13:35.711-0400</time> <!-- From the schema: "The creation date of the file." - Optional -->
 	<extensions>
 		<activity>http://dbpedia.org/resource/Running</activity>
-		<time>${w.date}</time>
-		<duration>${w.duration}</duration>
-		<distance>${w.distance}</distance>
-		<useragent>${w.distance}<useragent>
+		<time>${w.date.toString}</time>
+		<duration>${w.duration.toString}</duration>
+		<distance>${w.distance.toString}</distance>
+		<useragent>${w.useragent}</useragent>
 	</extensions>
 </metadata>
 
@@ -20,10 +19,10 @@
 
 #for (e <- w.events if (! e.status.isDefined))
 <% val Some((lon, lat, altO)) = e.c  %>
-	<trkpt lat="${lat}" lon="${lon}">
-		<time>e.timestamp</time>
+	<trkpt lat="${lat.toString}" lon="${lon.toString}">
+		<time>${e.timestamp.toString}</time>
 #if (altO.isDefined)
-		<ele>${altO.get}</ele>
+		<ele>${altO.get.toString}</ele>
 #end
 	</trkpt>
 #end
--- a/src/main/scala/Main.scala	Thu Aug 25 17:46:38 2011 -0400
+++ b/src/main/scala/Main.scala	Thu Aug 25 17:57:34 2011 -0400
@@ -61,7 +61,7 @@
         val realId = id.replaceAll(".json$", "").replaceAll(".gpx$", "")
         WorkoutDAO.findOneByID(realId) match {
           case Some(workout) if id endsWith ".gpx" =>
-            Ok ~> Scalate(req, "gpx.ssp", "w" -> workout)(engine)
+            Ok ~> ContentType("application/xml") ~> Scalate(req, "gpx.ssp", "w" -> workout)(engine)
           case Some(workout) if (id endsWith ".json") || (id == realId) =>
             Ok ~> ContentType("application/json") ~> ResponseString(workout.asJSON)
           case _ => NotFound