Mate Hegyhati

Quick hack to bulk delete activities in Garmin Connect

As of today, the web interface of Garmin Connect does not support bulk delete of activities. I presume, that this feature is not needed by 99% of the users, however, some of us live a dirty life, and sync among different sites, that can result in pretty messy activity data... For those of You who walk the same road as me, this post may provide a little bit of ease in cleaning up the mess.



First of all, let me praise GC for all the developement they bring to their web interface. Unlike RunKeeper, that hasn't changed anything in the last few years, GC developed a lot, and it is really a neat place to visit. There are a few features, that I still miss, like this bulk delete, or putting the map to fullscreen, but these are just minor issues. So before we dig into our topic: kudos to the GC developers. Also, if You do not care for the prologue, just skip the following sections and jump to the solution at the end. 

Why on the earth would somebody want to delete an activity?

I think I can speak for most of us, when I say, that tracked activities are like precious gems to us, runners (or cyclists, or whatever). Losing even a single one of them, and thus ruining our statistics is a major cause for days of depression. But seriously, tell me that You have never tried to somehow recover a track, that got somehow damaged or deleted. 

So why I or anybody would want to delete not just one of them, but a lot? Well, in my case, it is syncing. So come with me on a journey to one of the deepest pits of hell...

Where the problems started

March 2013, I start using RunKeeper to track my activities. First only running, then cycling, walking, skating, indoor rowing... I used RunKeeper to its fullest extent. Then, 2 years ago, I decided to level up, and buy a Garmin Fenix 2. One of the best decisions of my life, but it also resulted in a dilemma: should I have all my data on GC or RK? Well, I had all my previous data (1500+ activities) on RK already, and many friends, so I should havef something to sync my activities there. RK did not support GC sync at the time (not that its current official sync is a flawless solution), so I ended up registering to tapiirik.  Tapiirik is a nice service, and it has synced most of my activities. but not all. And some activities got to be "Other" instead of skating or rowing. But I didn't bother much, I was keeping RK as my main database, and only needed tapiirik to sync activities from GC to RK. For reasons explained in a later post, I've recently decided to ditch RK. But I need to move everything first to GC. Luckily, GC now allows bulk uploading of gpx files. Easy peasy. Even if I'll have to go month by month, I will still finish in a couple of hours. and I'm prepared to invest that much into this relocation. So, I started with the first month, and it was working. Then I had a look at the activities: "Type: Uncategorized" or "Other" and such things. So I shut the import down. But I already had plenty of junk in my database. This is only my story, but I imagine, that some other people can get into similar situations as well.

GC provided solution: delete activities one by one

Luckily, it is GC allows searching for activities and filtering them on the Activities full page. So, it is pretty easy to get all the junk data in a list. My eyes were looking for buttons like: Select all or Delete selected. If these two were available, I would not be writing this post. However, this is not the case, so here we are. Afaik the only way to delete this list of activities is to click on the trashbin icon on the right, than click on the Delete button a few tens of pixels to the left as it appears, and then wait for the line to disappear in an animated fashion to go for the next one. 



Now, this takes ~10 seconds per activity. I had several hundreds of junk in my database. It would have taken me a few hours and possibly my sanity to do this manually.

Actiona to the rescue!

Luckily, I am a lazy IT guy, that hates to do repetitive actions, and tries to automate everything he can. Actiona is a free automation tool available for various platforms.  What I wanted to do was really simple:
  1. Click on the trash icon
  2. Move the cursor a bit to the left
  3. Wait
  4. Click on the delete button
  5. Wait
  6. Start again from 1.
And this is exactly what I did. Probably there is a more sophisticated way of doing what I did (suggestions are welcome in the comment section), but at 2 am I went for the simplest one. Just create a procedure with the name "foobar", and call it (Line 006). Then let the procedure call itself before it ends (not the nicest loop implementation I know, but hey, it works!). Put a pause before that call, that allows the deleted line to disappear in a fancy animated way. (And it is also gives You time to stop the execution of this infinite loop, when finished.).



Within the procedure there are only 2 mouse clicks given, exactly as in step 1 and 4 above. Each click has a position parameter, and the second one also has a pause similar to the call action above. The position can easily be given by "dragging" that cross-hairs over the trash and delete buttons. 


And that's it. The only thing left to do is to let this small script do its job, and go out for a run.


A few remarks

  1. I know that if I would have looked at the source of the page, I probably could have written a much nicer JS function to the same, and upload it for others to use as well. That would have been much more portable. But, I'm not using JS, jQuery on the daily basis, so getting the selectors and everything right would have taken me much more time than writing this post. I'm also assuming, that GC will release this feature in the future, so all these hacks will hopefully be deprecated soon. 
  2. GC does not load the whole list at once. and it doesn't seem to reload new elements after deleting elements from the top. So I suggest, that first You put a heavy DC action figure on Your page down button to load the whole list. Unfortunately, this can render the animations on the site very slaw, and CPU consuming, but You are out on running, so doesn't matter. 
  3. This only works if You can select the activities into a list or a couple of lists without including activities that You want to keep. As this one will delete everything in the list.




As always: Thanks for reading! Sharing, comments and +1s are always appreciated. You can follow the blog on Google+Twitter, and Facebook. The embedded videos (and others) are collected in the RunnerMate playlist on my youtube channel, and quick running/cycling/etc related photos are shared on my Instagram.

Mate Hegyhati

About Mate Hegyhati

Amateur fun runner, geek, hiker.