 # we are not...
 checkRequiredChampion = (itemData) ->
   _.filter(itemData, (itemObject) ->
-    if itemObject.requiredChampion != undefined
+    if itemObject.requiredChampion?
       # if we are not the requiredChampion attribute
       # this needs to return false
       gon.champion == itemObject.requiredChampion


    # initialize oldItemSetBlocks, so we can compare to see
    # if change has occured
    $scope.oldItemSetBlocks = $scope.itemSetBlocks

  $scope.performFilter()
  $scope.initItemSetBlocks()

  , true)

  $scope.$watch('itemSetBlocks', () ->
    oldString = JSON.stringify($scope.oldItemSetBlocks)
    currentString = JSON.stringify($scope.itemSetBlocks)

    console.log(JSON.stringify($scope.itemSetBlocks))
    console.log(JSON.stringify($scope.oldItemSetBlocks))

    if oldString != currentString
      console.log('is not equal')
      $scope.hasChanged = true
    else
      console.log('is equal')
      $scope.hasChanged = false

  , true)

  # sends an ajax request to the rails web server to
  # sync the current item set to the ones stored
  # on the rails server
  #
  # this is called whenever apply changes is clicked
  $scope.updateItemSet = () ->
    obj = buildJSON($scope.itemSetBlocks, $scope.mapOption, $scope.selectedMap)
    console.log(obj)
