Change firstSyncCompletedAt to firstSyncCompletion, now explicitly 14 bytes.

This commit is contained in:
Halla Moore 2016-07-11 14:16:39 -07:00
parent 0860f3027c
commit 04ab0d9034
4 changed files with 7 additions and 7 deletions

View file

@ -22,7 +22,7 @@ function jsonSchema(modelName) {
// connection_settings: Joi.object(),
// sync_policy: Joi.object(),
// sync_error: Joi.object().allow(null),
// first_sync_completed_at: Joi.number().allow(null),
// first_sync_completion: Joi.number().allow(null),
// last_sync_completions: Joi.array(),
// })
}

View file

@ -12,7 +12,7 @@ module.exports = (sequelize, Sequelize) => {
connectionCredentials: Sequelize.TEXT,
syncPolicy: JSONType('syncPolicy'),
syncError: JSONType('syncError', {defaultValue: null}),
firstSyncCompletedAt: Sequelize.INTEGER,
firstSyncCompletion: Sequelize.INTEGER(14),
lastSyncCompletions: JSONARRAYType('lastSyncCompletions'),
}, {
classMethods: {
@ -31,7 +31,7 @@ module.exports = (sequelize, Sequelize) => {
connection_settings: this.connectionSettings,
sync_policy: this.syncPolicy,
sync_error: this.syncError,
first_sync_completed_at: this.firstSyncCompletedAt,
first_sync_completion: this.firstSyncCompletion,
last_sync_completions: this.lastSyncCompletions,
created_at: this.createdAt,
}

View file

@ -44,8 +44,8 @@ class Account extends React.Component {
const timeSinceLastSync = (Date.now() - newestSync) / 1000;
let firstSyncDuration = "Incomplete";
if (account.first_sync_completed_at) {
firstSyncDuration = (new Date(account.first_sync_completed_at) - new Date(account.created_at)) / 1000;
if (account.first_sync_completion) {
firstSyncDuration = (new Date(account.first_sync_completion) - new Date(account.created_at)) / 1000;
}
return (

View file

@ -197,8 +197,8 @@ class SyncWorker {
onSyncDidComplete() {
const {afterSync} = this._account.syncPolicy;
if (!this._account.firstSyncCompletedAt) {
this._account.firstSyncCompletedAt = Date.now()
if (!this._account.firstSyncCompletion) {
this._account.firstSyncCompletion = Date.now()
}
const now = Date.now();