[extensions-web/django/upgrade-1.8] cron: fixed model restriction error.



commit 099a53836617eff60e63ee370c288bbe5d347415
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Tue Oct 25 00:20:16 2016 +0300

    cron: fixed model restriction error.

 bin/sweettooth-cron-update |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/bin/sweettooth-cron-update b/bin/sweettooth-cron-update
index 88183cd..12080f1 100755
--- a/bin/sweettooth-cron-update
+++ b/bin/sweettooth-cron-update
@@ -21,5 +21,6 @@ for ext in Extension.objects.all():
     data = (ext.popularity_items
             .filter(date__gt=(datetime.datetime.now()-datetime.timedelta(days=7)))
             .aggregate(popularity=Sum('offset')))
-    ext.popularity = data['popularity']
-    ext.save(replace_metadata_json=False)
+    if data['popularity'] is not None:
+        ext.popularity = data['popularity']
+        ext.save(replace_metadata_json=False)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]