1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-01-03 13:45:49 +00:00

Extend snapshot Model.

This commit is contained in:
Manu 2018-11-01 19:35:07 +08:00
parent da4b9dbbed
commit dc2a156855
3 changed files with 5 additions and 4 deletions

View file

@ -96,7 +96,6 @@ def run(self):
self.result.emit(result) self.result.emit(result)
self.mutex.unlock() self.mutex.unlock()
def process_create_result(self, result): def process_create_result(self, result):
if result['returncode'] == 0: if result['returncode'] == 0:
new_snapshot, created = SnapshotModel.get_or_create( new_snapshot, created = SnapshotModel.get_or_create(
@ -104,7 +103,9 @@ def process_create_result(self, result):
defaults={ defaults={
'name': result['data']['archive']['name'], 'name': result['data']['archive']['name'],
'time': parser.parse(result['data']['archive']['start']), 'time': parser.parse(result['data']['archive']['start']),
'repo': self.profile.repo 'repo': self.profile.repo,
'duration': result['data']['archive']['duration'],
'size': result['data']['archive']['stats']['deduplicated_size']
} }
) )
new_snapshot.save() new_snapshot.save()

View file

@ -78,6 +78,8 @@ class SnapshotModel(peewee.Model):
name = peewee.CharField() name = peewee.CharField()
repo = peewee.ForeignKeyField(RepoModel, backref='snapshots') repo = peewee.ForeignKeyField(RepoModel, backref='snapshots')
time = peewee.DateTimeField() time = peewee.DateTimeField()
duration = peewee.FloatField(null=True)
size = peewee.IntegerField(null=True)
def formatted_time(self): def formatted_time(self):
return return

View file

@ -45,8 +45,6 @@ app = BUNDLE(exe,
'CFBundleShortVersionString': '0.2.0' 'CFBundleShortVersionString': '0.2.0'
}, },
) )
# Debug package. (inspired by borg-spec)
if False: if False:
coll = COLLECT(exe, coll = COLLECT(exe,
a.binaries, a.binaries,