<commit_before>angular.module('InescApp').directive 'uoGraph', ['$filter', ($filter) ->
  columns = [
    { sTitle: 'Entidade Orçamentária', bSortable: false },
    { sTitle: 'Orçamento Autorizado', bSortable: false }
  ]

  processData = (data, year) ->
    data.map (uo) ->
      entityUrl = $filter('entityUrl')
      currency = $filter('currency')
      console.log(uo)
      ["<a href='#{entityUrl(uo, year)}'>#{uo.label}</a>",
        currency(uo.amount, '')]

  options =
    bPaginate: false
    aaSorting: [[ 1, 'desc' ]]

  restrict: 'E',
  template: '<my-data-table columns="columns" options="options" data="data"></my-data-table>',
  scope:
    entity: '='
    year: '='
  link: (scope, element, attributes) ->
    scope.columns = columns
    scope.options = options
    scope.$watch 'entity.unidades_orcamentarias + year', ->
      [entity, year] = [scope.entity, scope.year]
      if entity? && entity.unidades_orcamentarias && year
        scope.data = processData(entity.unidades_orcamentarias, year)

]
<commit_msg>[#4] Adiciona percentual do autorizado e ordena<commit_after>angular.module('InescApp').directive 'uoGraph', ['$filter', ($filter) ->
  columns = [
    { sTitle: 'Entidade Orçamentária', bSortable: false }
    { sTitle: 'Orçamento Autorizado', bSortable: false }
    { sTitle: '%', bSortable: false }
    { sTitle: 'Orçamento Autorizado', bVisible: false } # Usado só para sorting
  ]

  processData = (entity, year) ->
    entityUrl = $filter('entityUrl')
    currency = $filter('currency')
    percentual = $filter('percentual')
    console.log(entity)
    entity.unidades_orcamentarias.map (uo) ->
      ["<a href='#{entityUrl(uo, year)}'>#{uo.label}</a>"
        currency(uo.amount, '')
        percentual((uo.amount*100)/entity.autorizado.total)
        uo.amount]

  options =
    bPaginate: false
    aaSorting: [[ 3, 'desc' ]]

  restrict: 'E',
  template: '<my-data-table columns="columns" options="options" data="data"></my-data-table>',
  scope:
    entity: '='
    year: '='
  link: (scope, element, attributes) ->
    scope.columns = columns
    scope.options = options
    scope.$watch 'entity.unidades_orcamentarias + year', ->
      [entity, year] = [scope.entity, scope.year]
      if entity? && entity.unidades_orcamentarias && year
        scope.data = processData(entity, year)
]

{'fraction_non_alphanumeric': 0.1702401372212693, 'fraction_numerical': 0.002572898799313894, 'mean_word_length': 3.4522900763358777, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '373714', 'n_tokens_mistral': 787, 'n_tokens_neox': 776, 'n_words': 156}