diff --git a/nextcloud_backup/backend/src/services/cronService.ts b/nextcloud_backup/backend/src/services/cronService.ts index c4a7f38..90d864b 100644 --- a/nextcloud_backup/backend/src/services/cronService.ts +++ b/nextcloud_backup/backend/src/services/cronService.ts @@ -36,7 +36,7 @@ export function initCron(backupConfig: BackupConfig) { rej(Error(cronItem.id)); } } - const nextDate = getNextDate(cronList); + const nextDate = getNextDate(); const status = getStatus(); status.next_backup = nextDate; setStatus(status); @@ -44,7 +44,7 @@ export function initCron(backupConfig: BackupConfig) { }); } -function getNextDate(cronList: Map) { +export function getNextDate() { let nextDate: DateTime | undefined = undefined; for (const item of cronList) { const thisDate = item[1].nextDate(); diff --git a/nextcloud_backup/backend/src/services/orchestrator.ts b/nextcloud_backup/backend/src/services/orchestrator.ts index 5125b96..95785d8 100644 --- a/nextcloud_backup/backend/src/services/orchestrator.ts +++ b/nextcloud_backup/backend/src/services/orchestrator.ts @@ -15,6 +15,7 @@ import * as backupConfigService from "./backupConfigService.js"; import * as homeAssistantService from "./homeAssistantService.js"; import { getBackupFolder, getWebdavConfig } from "./webdavConfigService.js"; import * as webDavService from "./webdavService.js"; +import { getNextDate } from "./cronService.js"; export function doBackupWorkflow(type: WorkflowType) { let name = ""; @@ -117,6 +118,7 @@ export function doBackupWorkflow(type: WorkflowType) { status.last_backup.success = true; status.last_backup.last_try = DateTime.now(); status.last_backup.last_success = DateTime.now(); + status.next_backup = getNextDate(); statusTools.setStatus(status); }) .catch(() => { @@ -216,6 +218,7 @@ function backupFail() { const status = statusTools.getStatus(); status.last_backup.success = false; status.last_backup.last_try = DateTime.now(); + status.next_backup = getNextDate(); statusTools.setStatus(status); messageManager.error("Last backup as failed !"); }