Commit a10f52e1 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Restructure some code

parent af181795
......@@ -298,11 +298,11 @@ class Site(models.Model):
def ack_update(self, service=None):
if service is None:
for du in self.deployment_updates.all():
du.delete()
du.done()
else:
for deployment_update in self.deployment_updates.all():
if deployment_update.service.name == service.name:
deployment_update.delete()
for du in self.deployment_updates.all():
if du.service.name == service.name:
du.done()
def clientapi_get_deployments(self, all=False, filter=None):
def service_deployments(service):
......@@ -314,7 +314,7 @@ class Site(models.Model):
in self.deployment_updates.all()
if deployment_update.service.name == service.name]
# TODO is this apropriate?
# TODO inappropriate
self.ack_update(service=service)
return ds
......@@ -501,6 +501,15 @@ class DeploymentUpdate(models.Model):
def service(self):
return self.deployment.service
# to be called if all clients have received the update
def done(self):
print("[DeploymentUpdate:{}:{}:{}] done".format(
self.service,
self.site,
self.user,
))
self.delete()
def __str__(self):
return str(self.user) + ':' + str(self.service) + '@' + str(self.site)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment