change change only to next one when editing existing registration
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 14 Feb 2013 16:02:04 +0000 (17:02 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 14 Feb 2013 16:02:04 +0000 (17:02 +0100)
app/js/controllers.js

index 4ddca47..e52344d 100644 (file)
@@ -17,7 +17,12 @@ function RegistrationCtrl($scope, $log, Registration, $routeParams, $location, $
 
        $scope.update = function(registration, state, info_message) {
 
-               registration.state = state;
+               if ( $scope.ValidStates.indexOf( state ) > $scope.ValidStates.indexOf( registration.state ) ) {
+                       registration.state = state;
+                       $log.info( 'registration.state updated to ',state);
+               } else {
+                       $log.info('registration.state NOT changed');
+               }
 
                if ( ! $scope.has_work && registration.work ) {
                        delete( registration.work );