 angular.module('app.controllers.fitness', ['resources.fitbit'])
-  .controller 'fitnessCtrl', ($scope, Fitbit) ->
+  .controller 'fitnessCtrl', ($scope, $timeout, Fitbit) ->
     Fitbit.user_info().then (fitbit_data) ->
       $scope.user = fitbit_data
 


    $scope.setTimeFrame = (time_frame) ->
      $scope.time_frame = time_frame
      $scope.getTimeSeriesData()

    $scope.stepChartConfig =
      data:

      Fitbit.sleep_time_series_data($scope.time_frame).then (fitbit_data) ->
        $scope.sleepChartConfig.data.json = fitbit_data['sleep-minutesAsleep']

    $scope.setTimeFrame('1w')
