Fix constant syncing due to future-dated items

This commit is contained in:
Dan Stillman 2010-05-05 18:07:01 +00:00
parent d39957fa56
commit c83d64ad0d
2 changed files with 5 additions and 2 deletions

View File

@ -147,7 +147,7 @@ Zotero.DataObjects = function (object, objectPlural, id, table) {
}
this.getNewer = function (date) {
this.getNewer = function (date, ignoreFutureDates) {
if (date && date.constructor.name != 'Date') {
throw ("date must be a JS Date in "
+ "Zotero." + this._ZDO_Objects + ".getNewer()")
@ -156,6 +156,9 @@ Zotero.DataObjects = function (object, objectPlural, id, table) {
var sql = "SELECT ROWID FROM " + this._ZDO_table;
if (date) {
sql += " WHERE clientDateModified>?";
if (ignoreFutureDates) {
sql += " AND clientDateModified<=CURRENT_TIMESTAMP";
}
return Zotero.DB.columnQuery(sql, Zotero.Date.dateToSQL(date, true));
}
return Zotero.DB.columnQuery(sql);

View File

@ -1532,7 +1532,7 @@ Zotero.Sync.Server = new function () {
// Check if any items were modified during /upload,
// and restart the sync if so
if (Zotero.Items.getNewer(nextLocalSyncDate)) {
if (Zotero.Items.getNewer(nextLocalSyncDate, true)) {
Zotero.debug("Items were modified during upload -- restarting sync");
Zotero.Sync.Server.sync(_callbacks, true, true);
return;