quinta-feira, junho 09, 2011

How to re-upload Endomondo's workout after having deleted it on the site

Imagine you've deleted a workout from your endomondo's profile in Endomondo's website. As of today there is no possibility to recover it to the site even if it still is in the phone.

In my case either was my phone having network problems or Endomondo's site was with problems. After my workout only part of it was in the site. It the phone the usual checked signed was replaced by two self-pointing arrows (later I discovered it means that the upload is not yet finished).

So, in Endomond's site, I deleted it and try to re-upload from the phone (Manual Upload and turning off/On Online Tracking) a few times... still didn't work. When network came back (or Endomondo fixed the problems in their site) the arrows were replaced by the usual icon. But in the site the workout was still missing. And in the phone, re-upload function disappeared. So I posted in Endomondo's facebook page: 
Today, because of network problems in the area where I was training, my workout was only partially uploaded.When I arrived home I saw a icon different than usual, two arrows. I tried to do "Manual upload" but no success (probably due to network problems still going).The problem was that I deleted the workout from Endomond's Page in order to try to solve the problem above... 
 Now phone network OK, and the arrows gone, but no workout on page.How can I solve this? I still have the workout on my android phone.
Endomondo's Answer:
Hi, we had some minor issues last night, but it is fixed now. If you have deleted the from your profile at endomondo.com there is no way of getting it back unfortunately. Sorry, Ture
Crap, there is an obvious missing functionality, like "force re-upload", undelete or, at leat, the question "are you sure... ?" should warn that there is is not possible to re-upload.
But I think this is only temporary as Endomondo will look into this problem somewhere in the future. Meanwhile I wanted my workout in the site.

But there is a solution, at least in android phones with SDCard (all I think):
I find out there is, on android phones, a way of exporting Endomondo's database (db).
Also, there is a way of importing it.
Analyzing the file I discovered that DB is actually an SQL Lite DB, so I copied it, downloaded an SQL Lite Editor and tried my luck:

So, my guess was that, if I changed the right values I might be lucky.
All my uploads were done, so I needed an incomplete one. To achieve this I turned off all networks on my android phone and recorded a new workout, re-exported the database and opened it in SQLite editor. The new workout record was different with uploadStatus=0, lastUpload=-1, the rest were normal fields.

In the missing workout, I changed those values and re-imported the modified db in Endomondo, connected the network and a few minutes later, finally, it appeared in the website.

So the instructions are:
The following, if not done properly might damage your Endomondo database. You might loose your workouts on your phone. If you do not feel comfortable in the following instructions don't do it)
  1.  Backup Endomondo DB. See instructions here:  http://endomondo.helpserve.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=79&nav=0,2,5
  2. Copy the file created in last step to your computer (Endomondo's backup will be a file in SDCard root named EndomondoDatabase).
  3. Backup the copied file because you will modify it and if it gets corrupted you'll only notice in Endomondo. And it that case it will be to late, you loose your data.
  4. Use a SQLite Editor and open the database file. You can use this one: http://sourceforge.net/projects/sqlitebrowser/
  5. Find the missing workout (for example by distance or other criteria like starttime);
  6. Change the fields uploadStatus and lastUpload to 0 and 1  respectively;
  7. Save the database (don't forget step 3); 
  8. Replace the modified database in your sdcard root directory with the one modified (in step 7).
  9. Re-Mount the sdcard.
  10. Start endomondo.
  11. Import the new DB into Endomondo. See instructions here:  http://endomondo.helpserve.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=79&nav=0,2,5
  12. In Endomondo, go to Settings > Workout Preference > Online Tracking, turn it off and and again back.Make sure your mobile phone has network, and a few seconds later your workout should be in the site (it may take a while to the data to be transmitted).
 Note: It looks there is a an sqllite db editor to Android. You may try to edit it directly in the phone. In this case don't forget to backup the backup.