From 2b653b8b05bc4c5dc8f5c916d530373ea463514a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Sun, 24 Feb 2019 11:30:44 +0100 Subject: [PATCH] upgrades --- server/src/uds/core/managers/userservice/opchecker.py | 8 ++++---- server/src/uds/models/UserService.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/src/uds/core/managers/userservice/opchecker.py b/server/src/uds/core/managers/userservice/opchecker.py index d0fa1edc0..0e8ecb9be 100644 --- a/server/src/uds/core/managers/userservice/opchecker.py +++ b/server/src/uds/core/managers/userservice/opchecker.py @@ -40,7 +40,7 @@ from uds.models import UserService import logging -__updated__ = '2019-02-22' +__updated__ = '2019-02-24' logger = logging.getLogger(__name__) @@ -63,9 +63,9 @@ class StateUpdater(object): def save(self, newState=None): if newState is not None: - self.userService.setState(newState) - self.userService.updateData(self.userServiceInstance) - self.userService.save(update_fields=['data', 'state', 'state_date']) + self.userService.setState(newState) # This saves state & state_date + self.userService.updateData(self.userServiceInstance) # This saves data + # self.userService.save(update_fields=['data', 'state', 'state_date']) def checkLater(self): UserServiceOpChecker.checkLater(self.userService, self.userServiceInstance) diff --git a/server/src/uds/models/UserService.py b/server/src/uds/models/UserService.py index 808be45e8..1c20e1a62 100644 --- a/server/src/uds/models/UserService.py +++ b/server/src/uds/models/UserService.py @@ -188,6 +188,7 @@ class UserService(UUIDModel): :note: This method do not saves the updated record, just updates the field ''' self.data = us.serialize() + self.save(update_fields=['data']) def getName(self): ''' @@ -320,6 +321,8 @@ class UserService(UUIDModel): self.state_date = getSqlDatetime() self.state = state + self.save(update_fields=['state', 'state_date']) + def setOsState(self, state): ''' Updates the os state (state of the os) of this object and, optionally, saves it