 
     getStimulus: (id) -> @_local[id].stimulus_html
 
-    # getEditableTags: (id) -> getTagTypes(@_local[id].tags).editable
-
-    # getFixedTags: (id) -> getTagTypes(@_local[id].tags).fixed
-
     getPublishedDate: (id) -> @_local[id].published_at
 
     isPublished: (id) -> @_local[id].published_at


EmptyFn = -> ''

FixedTags = [{
  base: 'blooms'
  range: [1...8]
  separator: '-'
}, {
  base: 'dok'
  range: [1...4]
  separator: ''
}, {
  base: 'time'
  range: ['short', 'medium', 'long']
  separator: '-'
}]


isFixedTagType = (tag, fixedTag) -> tag.indexOf("#{fixedTag.base}#{fixedTag.separator}") isnt -1

getTagTypes = (tags) ->
  #filter out all editable tags
  editable = _.filter tags, (tag) ->
    _.reduce(FixedTags, (memo, fixedTag) ->
      memo and not isFixedTagType(tag, fixedTag)
    , true)

  fixedArray = _.filter tags, (tag) -> editable.indexOf(tag) is -1

  #get all fixed tags with value attribute
  fixed = _.map(FixedTags, (fixedTag) ->
    value = _.reduce(fixedArray, (memo, tag) ->
      if isFixedTagType(tag, fixedTag)
        tag
      else
        memo
    , '')

    _.extend({}, fixedTag, {value})
  )

  #return both types of tags
  return {fixed, editable}

ExerciseConfig = {
  _loaded: cascadeLoad
  _asyncStatusPublish: {}


  updateStimulus: (id, stimulus_html) -> @_change(id, {stimulus_html})

  addBlankPrefixedTag: (id, {prefix}) ->
    prefix += ':'
    tags = _.clone( @_get(id).tags )
    unless 0 is tags.indexOf(prefix) # is there already a blank one?
      tags.push(prefix)
      @_change(id, {tags})



  # Updates or creates a prefixed tag
