diff --git a/platform/features/clock/src/actions/PauseTimerAction.js b/platform/features/clock/src/actions/PauseTimerAction.js index 0d94e07a21..f3e5910bef 100644 --- a/platform/features/clock/src/actions/PauseTimerAction.js +++ b/platform/features/clock/src/actions/PauseTimerAction.js @@ -58,16 +58,12 @@ define( var domainObject = this.domainObject, now = this.now; - function setTimerState(model) { + function updateModel(model) { model.timerState = 'paused'; - } - - function setPausedTime(model) { model.pausedTime = now(); } - return domainObject.useCapability('mutation', setTimerState) && - domainObject.useCapability('mutation', setPausedTime); + return domainObject.useCapability('mutation', updateModel); }; return PauseTimerAction; diff --git a/platform/features/clock/src/actions/RestartTimerAction.js b/platform/features/clock/src/actions/RestartTimerAction.js index 4197b0c082..dad88dad3a 100644 --- a/platform/features/clock/src/actions/RestartTimerAction.js +++ b/platform/features/clock/src/actions/RestartTimerAction.js @@ -56,21 +56,13 @@ define( var domainObject = this.domainObject, now = this.now; - function setTimestamp(model) { + function updateModel(model) { model.timestamp = now(); - } - - function setTimerState(model) { model.timerState = 'started'; - } - - function setPausedTime(model) { model.pausedTime = undefined; } - return domainObject.useCapability('mutation', setTimestamp) && - domainObject.useCapability('mutation', setTimerState) && - domainObject.useCapability('mutation', setPausedTime); + return domainObject.useCapability('mutation', updateModel); }; return RestartTimerAction; diff --git a/platform/features/clock/src/actions/StartTimerAction.js b/platform/features/clock/src/actions/StartTimerAction.js index c1b49c805b..a88170db57 100644 --- a/platform/features/clock/src/actions/StartTimerAction.js +++ b/platform/features/clock/src/actions/StartTimerAction.js @@ -57,7 +57,7 @@ define( var domainObject = this.domainObject, now = this.now; - function setTimestamp(model) { + function updateModel(model) { //if we are resuming if (model.pausedTime) { var timeShift = now() - model.pausedTime; @@ -65,19 +65,11 @@ define( } else { model.timestamp = now(); } - } - - function setTimerState(model) { model.timerState = 'started'; - } - - function setPausedTime(model) { model.pausedTime = undefined; } - return domainObject.useCapability('mutation', setTimestamp) && - domainObject.useCapability('mutation', setTimerState) && - domainObject.useCapability('mutation', setPausedTime); + return domainObject.useCapability('mutation', updateModel); }; return StartTimerAction; diff --git a/platform/features/clock/src/actions/StopTimerAction.js b/platform/features/clock/src/actions/StopTimerAction.js index f91fcde7bf..806e27c746 100644 --- a/platform/features/clock/src/actions/StopTimerAction.js +++ b/platform/features/clock/src/actions/StopTimerAction.js @@ -57,21 +57,13 @@ define( StopTimerAction.prototype.perform = function () { var domainObject = this.domainObject; - function setTimestamp(model) { + function updateModel(model) { model.timestamp = undefined; - } - - function setTimerState(model) { model.timerState = 'stopped'; - } - - function setPausedTime(model) { model.pausedTime = undefined; } - return domainObject.useCapability('mutation', setTimestamp) && - domainObject.useCapability('mutation', setTimerState) && - domainObject.useCapability('mutation', setPausedTime); + return domainObject.useCapability('mutation', updateModel); }; return StopTimerAction;