 
     onRowPeriod: (period) ->
       period.time ?= period.stop - period.start
-      @transformRowData period.row, "timePeriods", (current) =>
-        current ?= []
-        current.push period
-        current
       @_addTimeToRow period.row, period.time, period.stop
       @_addTimeToAncestors period.row, period.time, period.stop
 

# Time-tracking keeps track of the amount of time spent in each subtree.
# Clones are double-counted. This is a known bug and will not be fixed.
(() ->

  pad = (val, length, padChar = '0') ->
    val += ''
    numPads = length - val.length
    if (numPads > 0) then new Array(numPads + 1).join(padChar) + val else val

  sum = (a) ->
    total = 0
    for x in a
      total += x
    total

  Plugins.register {
    name: "Time Tracking"

      rowTotalTime = @getRowData id, "rowTotalTime"
      deletedChildrenTotalTimes = _.map deletedChildren, (x) -> x['totalTime']
      totalTimes = _.compact [rowTotalTime].concat(childTotalTimes).concat(deletedChildrenTotalTimes)
      totalTime = totalTimes.reduce (a,b) -> (a+b)
      @setRowData id, "treeTotalTime", totalTime

    onRowRemoved: (event) ->
      deletedChildren = (@getRowData event.parent_id, 'deletedChildren') ? {}
      deletedChildren[event.id] = {
        totalTime: (@getRowData event.id, "treeTotalTime") ? 0
      }
      @setRowData event.parent_id, 'deletedChildren', deletedChildren
      for ancestor_id in @api.view.data.allAncestors event.id, { inclusive: false }
