Bug 772676 - History visit counts are all 1 after migration. r=margaret a=akeybl
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Fri, 13 Jul 2012 07:49:38 +0200
changeset 100293 1e208424d68ea8b184373ed8b44d4320f772175d
parent 100290 952b175db4ec4fc399f85af04ae408814838cd46
child 100294 327b951ff6a83154e1f66ba28a8dc4d9a4f9b205
push id1138
push usergpascutto@mozilla.com
push dateMon, 23 Jul 2012 09:32:26 +0000
treeherdermozilla-beta@1e208424d68e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, akeybl
bugs772676
milestone15.0
Bug 772676 - History visit counts are all 1 after migration. r=margaret a=akeybl
mobile/android/base/ProfileMigrator.java
mobile/android/base/db/LocalBrowserDB.java
--- a/mobile/android/base/ProfileMigrator.java
+++ b/mobile/android/base/ProfileMigrator.java
@@ -234,17 +234,17 @@ public class ProfileMigrator {
       We must divide date by 1000 due to the micro (Places)
       vs milli (Android) distiction.
     */
     private static final String HISTORY_QUERY_SELECT =
         "SELECT places.url              AS p_url, "       +
         "       places.title            AS p_title, "     +
         "       places.guid             AS p_guid, "      +
         "       MAX(history.visit_date) AS h_date, "      +
-        "       COUNT(*) AS h_visits, "                   +
+        "       COUNT(*)                AS h_visits, "    +
         // see BrowserDB.filterAllSites for this formula
         "       MAX(1, 100 * 225 / (" +
         "          ((MAX(history.visit_date)/1000 - ?) / 86400000) * " +
         "          ((MAX(history.visit_date)/1000 - ?) / 86400000) + 225)) AS a_recent, ";
 
     private static final String HISTORY_QUERY_TRAILER =
         "FROM (moz_historyvisits AS history "             +
         "      JOIN moz_places AS places "                +
--- a/mobile/android/base/db/LocalBrowserDB.java
+++ b/mobile/android/base/db/LocalBrowserDB.java
@@ -684,17 +684,17 @@ public class LocalBrowserDB implements B
                 int oldVisits = cursor.getInt(visitsCol);
                 long oldDate = cursor.getLong(dateCol);
                 values.put(History.VISITS, oldVisits + visits);
                 // Only update last visited if newer.
                 if (date > oldDate) {
                     values.put(History.DATE_LAST_VISITED, date);
                 }
             } else {
-                values.put(History.VISITS, 1);
+                values.put(History.VISITS, visits);
                 values.put(History.DATE_LAST_VISITED, date);
             }
             if (title != null) {
                 values.put(History.TITLE, title);
             }
             values.put(History.URL, url);
 
             Uri historyUri = getAllHistoryUri().buildUpon().