 _persisted = {}
 _trainingModule = {}
 _editableBlockIds = []
-_editingAddedBlock = false
 
 # Utilities
 setBlocks = (data, persisted=false) ->

    order: week_blocks.length,
    duration: null
  }
  setBlock block
  setEditableBlockId(block.id)

removeBlock = (block_id) ->
  delete _blocks[block_id]
  _editingAddedBlock = false
  BlockStore.emitChange()

insertBlock = (block, toWeek, targetIndex) ->

  if fromWeekId != toWeek.id
    toWeekBlocks = BlockStore.getBlocksInWeek(toWeek.id)
    toWeekBlocks.forEach (b, i) ->
      b.order = i
      setBlock b, true
  BlockStore.emitChange()

setEditableBlockId = (blockId) ->
  _editableBlockIds.push(blockId)
  BlockStore.emitChange()


