Can't save empty workouts
authorPhilippe Le Hegaret <plh@w3.org>
Thu, 25 Aug 2011 14:10:40 -0400
changeset 79 87f930f95eb5
parent 76 96f1bdf10a05
child 80 399b81b86b08
Can't save empty workouts
src/main/resources/scripts/tracker.js
--- a/src/main/resources/scripts/tracker.js	Thu Aug 25 13:13:58 2011 -0400
+++ b/src/main/resources/scripts/tracker.js	Thu Aug 25 14:10:40 2011 -0400
@@ -233,10 +233,13 @@
   app.duration = 0;
   document.getElementById("start").textContent = "Start";
   document.getElementById("stop").disabled = true;
-  if (!Util.postNewResourceAsJSON(user.getPostRunURI(),app.currentActivity)) {      
+  if (app.currentActivity.events.length > 2) {
+  	!Util.postNewResourceAsJSON(user.getPostRunURI(),app.currentActivity)) {      
     if (!Util.store.set("track_gps_app", app.currentActivity)) {
-      Util.log("[ERROR] Can't store the value " + e.code);
+      Util.log("[ERROR] Can't store the workout");
     }
+  } else {
+  	Util.log("[ERROR] Your workout doesn't contain enought events");
   }
   app.currentActivity = new Activity("http://dbpedia.org/resource/Running");
 }