-angular.module("logbuch").factory "Track", (StorageService, Log) ->
+angular.module("logbuch").factory "Track", (StorageService, Log, DebugLog) ->
   class Track
     @attributes = ['lat', 'long', 'waypoints', 'distanceKm', 'distanceNm', 'speedKmh', 'speedKn']
 


    @convertKmtoNm = (km) ->
      parseFloat(km) * 0.539956803456

    @fromStorage = ->
      stored = StorageService.getObject('currentTrack')

    updateCurrentPosition: (position) ->
      @lat      = position.latLng.lat
      @long     = position.latLng.lng
      @speedKmh = Track.convertMsToKmh(position.coords.speed)
      @speedKn  = Track.convertKmtoNm(@speedKmh)
      new DebugLog("Track Speed: #{position.coords.speed}", "km/h: #{@speedKmh}").save()

      @calculateTotalDistance()
      @calculateCurrentDistance()
      #@calculateCurrentSpeed()

      true

