[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kactivities] service/plugins/activityranking: Ranking plugin: do not insert data for empty location
From:       Lamarque V. Souza <lamarque () kde ! org>
Date:       2012-03-20 15:10:51
Message-ID: 20120320151051.EE830A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 184c0d4ea6bea1332751e8454f6f0fd9d6402087 by Lamarque V. Souza.
Committed on 20/03/2012 at 16:09.
Pushed by lvsouza into branch 'master'.

Ranking plugin: do not insert data for empty location in the database.

M  +11   -1    service/plugins/activityranking/activityranking.cpp

http://commits.kde.org/kactivities/184c0d4ea6bea1332751e8454f6f0fd9d6402087

diff --git a/service/plugins/activityranking/activityranking.cpp \
b/service/plugins/activityranking/activityranking.cpp index ada7596..e85baf1 100644
--- a/service/plugins/activityranking/activityranking.cpp
+++ b/service/plugins/activityranking/activityranking.cpp
@@ -175,6 +175,10 @@ void \
ActivityRankingPlugin::Private::ensureMonthScoreExists(const QString & acti  void \
ActivityRankingPlugin::Private::processActivityInterval(const QString & activity, \
const QString & location, qint64 start, qint64 end)  {
     kDebug() << activity << location << start << end;
+    if (activity.isEmpty() || location.isEmpty()) {
+        kDebug() << "empty activity id or location. Not processing.";
+        return;
+    }
 
     // Processing the per-week data
     processWeekData(activity, location, start, end);
@@ -553,6 +557,11 @@ void ActivityRankingPlugin::activityChanged(const QString & \
activity)  
 void ActivityRankingPlugin::locationChanged(const QString &location)
 {
+    if (location.isEmpty()) {
+        kDebug() << ">>>> not processing empty location";
+        return;
+    }
+
     qint64 currentTime = QDateTime::currentMSecsSinceEpoch();
 
     kDebug() << ">>>> we have the new location" << location;
@@ -594,7 +603,8 @@ QMap <QString, qreal> \
ActivityRankingPlugin::Private::topActivitiesFor(const QDa  QMap <QString, qreal> \
result;  
     if (location.isEmpty()) {
-        kWarning() << "location should not be empty";
+        kDebug() << "location must not be empty";
+        return;
     }
 
     // We want to get the scores for the current week segment


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic