1
0
mirror of https://github.com/laurent22/joplin.git synced 2026-05-22 09:05:38 +02:00

Status screen

This commit is contained in:
Laurent Cozic
2017-07-10 20:16:59 +01:00
parent 3f50e419da
commit e882c7b339
7 changed files with 95 additions and 4 deletions
+10 -1
View File
@@ -56,12 +56,16 @@ class BaseItem extends BaseModel {
synced: syncedCount,
};
output.toDelete = {
total: await this.deletedItemCount(),
};
return output;
}
static async syncedCount() {
const ItemClass = this.itemClass(this.modelType());
const r = await this.db().selectOne('SELECT count(*) as total FROM `' + ItemClass.tableName() + '` WHERE updated_time > sync_time');
const r = await this.db().selectOne('SELECT count(*) as total FROM `' + ItemClass.tableName() + '` WHERE updated_time <= sync_time');
return r.total;
}
@@ -143,6 +147,11 @@ class BaseItem extends BaseModel {
return this.db().selectAll('SELECT * FROM deleted_items');
}
static async deletedItemCount() {
let r = await this.db().selectOne('SELECT count(*) as total FROM deleted_items');
return r['total'];
}
static remoteDeletedItem(itemId) {
return this.db().exec('DELETE FROM deleted_items WHERE item_id = ?', [itemId]);
}