diff --git a/tasks.py b/tasks.py
index 186d918..c183795 100644
--- a/tasks.py
+++ b/tasks.py
@@ -44,7 +44,9 @@ def update_keywords():
for a in annotation.models.Annotation.objects.filter(layer='keywords').all().values('value')
])
data = ['
']
- for k in sorted(keywords.keys(), key=lambda k: ox.sort_string('%s %s' % (keywords[k], k)), reverse=True):
+ def s(k):
+ return ox.sort_string('%s %s' % (10000-keywords[k], k)).lower()
+ for k in sorted(keywords.keys(), key=s):
data.append('- %d %s' %((keywords[k], k.replace(' ', '_'), k)))
data.append('
')
t.text = '\n'.join(data)