       )
 
     $scope.stopTracking = ->
-      trackedTimes.customPUT(null, "stop").then((result) ->
-        $scope.current = null
-        $interval.cancel(timer);
-        $scope.times = trackedTimes.getList().$object
-      ,
-      onError
+      trackedTimes.customPUT(null, "stop").then(
+        (result) ->
+          $scope.current = null
+          $interval.cancel(timer);
+          $scope.times = trackedTimes.getList().$object
+        onError
       )
 
     $scope.delete = (id) ->

controllers = angular.module('controllers')
controllers.controller("TimesController", [ '$scope', '$routeParams', '$location', 'Restangular', '$interval'
  ($scope, $routeParams, $location, Restangular, $interval) ->
    $scope.times = []
    $scope.newTrackedTime = {}
    $scope.flash_error = null

    trackedTimes = Restangular.all('tracked_times');

    timer = null

    $scope.times = trackedTimes.getList().$object

    trackedTimes.customGET("current").then (result) ->

            $scope.current.duration += 1
          , 1000)


    # Event handlers
    $scope.clearErrors = ->
      $scope.flash_error = null

    $scope.startTracking = (newTrackedTime) ->
      trackedTimes.post(newTrackedTime).then(
        (result)->
          $scope.newTrackedTime = {}
          $scope.current = result
          timer = $interval( ->
              $scope.current.duration += 1
