<commit_before>Wheelmap.ToolbarController = Ember.ArrayController.extend
  _extraFilter: false # Flag for executing special status filter behavior only once

  needs: ['index', 'map']

  statusFilters: null
  toiletFilters: null
  queryString: null
  itemController: 'category'
  sortProperties: ['name']

  init: ()->
    @_super()

    statusFilters = [
      Ember.Object.create({ key: 'yes', isActive: true })
      Ember.Object.create({ key: 'limited', isActive: true })
      Ember.Object.create({ key: 'no', isActive: true })
      Ember.Object.create({ key: 'unknown', isActive: true })
    ]

    toiletFilters = [
      Ember.Object.create({ key: 'yes', isActive: true })
      Ember.Object.create({ key: 'no', isActive: true })
      Ember.Object.create({ key: 'unknown', isActive: true })
    ]

    @set('statusFilters', statusFilters)
    @set('toiletFilters', toiletFilters)

    return

  ###
  # Property containing all active categories
  ###
  activeCategories: ((key, activeCategories)->
    if activeCategories?
      return @filter (category)->
        isActive = activeCategories.contains(category)
        category.set('isActive', isActive)

        return isActive

    @filterBy('isActive')
  ).property('@each.isActive')

  searchString: Ember.computed('queryString', ->
    return decodeURIComponent(this.get('queryString').replace(/\+/g, ' '))
  )

  activeStatusFilters: ((key, activeStatusFilters)->
    statusFilters = @get('statusFilters')

    if activeStatusFilters?
      return statusFilters.filter (statusFilter)->
        isActive = activeStatusFilters.contains(statusFilter)
        statusFilter.set('isActive', isActive)

        return isActive
<commit_msg>Fix a possible null error<commit_after>Wheelmap.ToolbarController = Ember.ArrayController.extend
  _extraFilter: false # Flag for executing special status filter behavior only once

  needs: ['index', 'map']

  statusFilters: null
  toiletFilters: null
  queryString: null
  itemController: 'category'
  sortProperties: ['name']

  init: ()->
    @_super()

    statusFilters = [
      Ember.Object.create({ key: 'yes', isActive: true })
      Ember.Object.create({ key: 'limited', isActive: true })
      Ember.Object.create({ key: 'no', isActive: true })
      Ember.Object.create({ key: 'unknown', isActive: true })
    ]

    toiletFilters = [
      Ember.Object.create({ key: 'yes', isActive: true })
      Ember.Object.create({ key: 'no', isActive: true })
      Ember.Object.create({ key: 'unknown', isActive: true })
    ]

    @set('statusFilters', statusFilters)
    @set('toiletFilters', toiletFilters)

    return

  ###
  # Property containing all active categories
  ###
  activeCategories: ((key, activeCategories)->
    if activeCategories?
      return @filter (category)->
        isActive = activeCategories.contains(category)
        category.set('isActive', isActive)

        return isActive

    @filterBy('isActive')
  ).property('@each.isActive')

  searchString: Ember.computed('queryString', ->
    queryString = this.get('queryString')
    if queryString?
      return decodeURIComponent(queryString.replace(/\+/g, ' '))
    else
      return queryString
  )

  activeStatusFilters: ((key, activeStatusFilters)->
    statusFilters = @get('statusFilters')

    if activeStatusFilters?
      return statusFilters.filter (statusFilter)->
        isActive = activeStatusFilters.contains(statusFilter)
        statusFilter.set('isActive', isActive)

        return isActive

{'fraction_non_alphanumeric': 0.13157894736842105, 'fraction_numerical': 0.0, 'mean_word_length': 3.4890885750962775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '980425', 'n_tokens_mistral': 1021, 'n_tokens_neox': 1024, 'n_words': 233}