← Back to team overview

zeitgeist team mailing list archive

[Branch ~zeitgeist/zeitgeist/bluebird] Rev 237: Added destinction rules based on the old ZG

 

------------------------------------------------------------
revno: 237
committer: Seif Lotfy <seif@xxxxxxxxx>
branch nick: bluebird
timestamp: Thu 2011-09-08 19:49:17 +0200
message:
  Added destinction rules based on the old ZG
modified:
  src/engine.vala


--
lp:~zeitgeist/zeitgeist/bluebird
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch lp:~zeitgeist/zeitgeist/bluebird.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'src/engine.vala'
--- src/engine.vala	2011-09-05 19:43:04 +0000
+++ src/engine.vala	2011-09-08 17:49:17 +0000
@@ -147,8 +147,17 @@
 
     public uint32[] find_event_ids (TimeRange time_range,
         GenericArray<Event> event_templates,
+        uint storage_state, uint max_events, uint result_type, 
+        BusName? sender=null) throws EngineError
+    {
+        return find_event_ids_logic(time_range, event_templates, storage_state,
+            max_events, result_type);
+    }
+
+    private uint32[] find_event_ids_logic (TimeRange time_range,
+        GenericArray<Event> event_templates,
         uint storage_state, uint max_events, uint result_type,
-        BusName? sender=null) throws EngineError
+        bool distinct = true, BusName? sender=null) throws EngineError
     {
 
         WhereClause where = new WhereClause (WhereClause.Type.AND);
@@ -188,8 +197,11 @@
 
         // FIXME: IDs: SELECT DISTINCT / events: SELECT
         // Is the former faster or can we just do the unique'ing on our side?
-
-        string sql = "SELECT DISTINCT id FROM event_view ";
+        string sql;
+        if (distinct)
+            sql = "SELECT DISTINCT id FROM event_view ";
+        else
+            sql = "SELECT id FROM event_view ";
         string where_sql = "";
         if (!where.is_empty ())
         {
@@ -320,8 +332,10 @@
 
         while ((rc = stmt.step()) == Sqlite.ROW)
         {
-            event_ids += (uint32) uint64.parse(
+            var id = (uint32) uint64.parse(
                 stmt.column_text (EventViewRows.ID));
+            //if (!(id in event_ids))
+            event_ids += id;
         }
         if (rc != Sqlite.DONE)
         {
@@ -339,8 +353,8 @@
         uint storage_state, uint max_events, uint result_type,
         BusName? sender=null) throws EngineError
     {
-        return get_events (find_event_ids (time_range, event_templates,
-            storage_state, max_events, result_type));
+        return get_events (find_event_ids_logic (time_range, event_templates,
+            storage_state, max_events, result_type, false));
     }
 
     private struct RelatedUri {