This commit is contained in:
shivansh02 2024-05-12 15:26:15 +05:30
parent ec47d5ce1e
commit fd96b37a4f
2 changed files with 5 additions and 7 deletions

View File

@ -11,16 +11,15 @@ from PyQt6.QtWidgets import QApplication
from vorta import application
from vorta.borg.check import BorgCheckJob
from vorta.borg.compact import BorgCompactJob
from vorta.borg.create import BorgCreateJob
from vorta.borg.list_repo import BorgListRepoJob
from vorta.borg.prune import BorgPruneJob
from vorta.borg.compact import BorgCompactJob
from vorta.i18n import translate
from vorta.notifications import VortaNotifications
from vorta.store.models import BackupProfileModel, EventLogModel
from vorta.utils import borg_compat
logger = logging.getLogger(__name__)
@ -491,7 +490,7 @@ class VortaScheduler(QtCore.QObject):
job = BorgCheckJob(msg['cmd'], msg, profile.repo.id)
self.app.jobs_manager.add_job(job)
compaction_cutoff = dt.now() - timedelta(minutes=7 * profile.compaction_weeks)
compaction_cutoff = dt.now() - timedelta(weeks=7 * profile.compaction_weeks)
recent_compactions = (
EventLogModel.select()
.where(
@ -501,8 +500,8 @@ class VortaScheduler(QtCore.QObject):
)
.count()
)
if profile.compaction_on and recent_compactions == 0:
if profile.compaction_on and recent_compactions == 0 and borg_compat.version >= 1.2:
msg = BorgCompactJob.prepare(profile)
if msg['ok']:
job = BorgCompactJob(msg['cmd'], msg, profile.repo.id)

View File

@ -70,7 +70,6 @@ class ScheduleTab(ScheduleBase, ScheduleUI, BackupProfileMixin):
self.validationCheckBox.toggled.connect(self.frameValidation.setEnabled)
self.compactionCheckBox.toggled.connect(self.frameCompaction.setEnabled)
# POPULATE with data
self.populate_from_profile()
self.set_icons()
@ -163,7 +162,7 @@ class ScheduleTab(ScheduleBase, ScheduleUI, BackupProfileMixin):
)
self.validationWeeksCount.setValue(profile.validation_weeks)
#set borg compact options
# set borg compact options
self.compactionCheckBox.setCheckState(
QtCore.Qt.CheckState.Checked if profile.compaction_on else QtCore.Qt.CheckState.Unchecked
)