<commit_before>#
# Mnoe Users List
#
@App.directive('mnoeUsersList', ($filter, LIST_STATE) ->
  restrict: 'E'
  scope: {
    list: '='
  },
  templateUrl: 'app/components/mnoe-users-list/mno-users-list.html',
  link: (scope) ->
    scope.LIST_STATE = LIST_STATE

    # Variables initialization
    scope.users =
      displayList: []
      search: ''
      state: LIST_STATE.last10

    setLastUsersList = () ->
      scope.users.state = LIST_STATE.last10
      scope.users.displayList = $filter('orderBy')(scope.list, '-created_at')
      scope.users.displayList = $filter('limitTo')(scope.users.displayList, 10)

    setSearchUsersList = (ro) ->
      scope.users.state = LIST_STATE.search
      searchToLowerCase = scope.users.search.toLowerCase()
      scope.users.displayList = _.filter(scope.list, (user) ->
        email = _.startsWith(user.email.toLowerCase(), searchToLowerCase)
        name = _.startsWith(user.name.toLowerCase(), searchToLowerCase)
        surname = _.startsWith(user.surname.toLowerCase(), searchToLowerCase)
        (email || name || surname)
      )
      scope.users.displayList = $filter('orderBy')(scope.users.displayList, 'email')

    scope.searchChange = () ->
      if scope.users.search == ''
        setLastUsersList()
      else
        setSearchUsersList()

    scope.$watch('list', (newVals, oldVals) ->
      console.log newVals, oldVals
      setLastUsersList()
    , true)
)<commit_msg>Remove useless parameter<commit_after>#
# Mnoe Users List
#
@App.directive('mnoeUsersList', ($filter, LIST_STATE) ->
  restrict: 'E'
  scope: {
    list: '='
  },
  templateUrl: 'app/components/mnoe-users-list/mno-users-list.html',
  link: (scope) ->
    scope.LIST_STATE = LIST_STATE

    # Variables initialization
    scope.users =
      displayList: []
      search: ''
      state: LIST_STATE.last10

    setLastUsersList = () ->
      scope.users.state = LIST_STATE.last10
      scope.users.displayList = $filter('orderBy')(scope.list, '-created_at')
      scope.users.displayList = $filter('limitTo')(scope.users.displayList, 10)

    setSearchUsersList = () ->
      scope.users.state = LIST_STATE.search
      searchToLowerCase = scope.users.search.toLowerCase()
      scope.users.displayList = _.filter(scope.list, (user) ->
        email = _.startsWith(user.email.toLowerCase(), searchToLowerCase)
        name = _.startsWith(user.name.toLowerCase(), searchToLowerCase)
        surname = _.startsWith(user.surname.toLowerCase(), searchToLowerCase)
        (email || name || surname)
      )
      scope.users.displayList = $filter('orderBy')(scope.users.displayList, 'email')

    scope.searchChange = () ->
      if scope.users.search == ''
        setLastUsersList()
      else
        setSearchUsersList()

    scope.$watch('list', (newVals, oldVals) ->
      console.log newVals, oldVals
      setLastUsersList()
    , true)
)
{'fraction_non_alphanumeric': 0.1427079707622694, 'fraction_numerical': 0.004176818656456666, 'mean_word_length': 3.0195804195804197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2016649', 'n_tokens_mistral': 921, 'n_tokens_neox': 927, 'n_words': 143}