<commit_before>controller = ($scope) ->

  $scope.data = {
    nodes: [
      {"name":"AAAAAA","group":1}, {"name":"BBBBBBBB","group":1},
      {"name":"CCCCC","group":1}, {"name":"DDDDD","group":1}
      {"name":"EEE","group":2}, {"name":"GG","group":2}
      {"name":"FF","group":2}, {"name":"HH","group":2}
    ]
    links: [
      {"source":0,"target":2,"value":1},
      {"source":0,"target":3,"value":1},
      {"source":0,"target":2,"value":1},
      {"source":0,"target":3,"value":1},
      {"source":0,"target":4,"value":1},
      {"source":0,"target":5,"value":1},
      {"source":0,"target":6,"value":1},
      {"source":0,"target":7,"value":1},
      {"source":0,"target":7,"value":1},
      {"source":1,"target":2,"value":1},
      {"source":1,"target":3,"value":1},
      {"source":1,"target":2,"value":1},
      {"source":1,"target":3,"value":1},
      {"source":1,"target":4,"value":1},
      {"source":1,"target":5,"value":1},
      {"source":1,"target":6,"value":1},
      {"source":1,"target":7,"value":1},
      {"source":1,"target":7,"value":1}
    ]
  }

app = angular.module 'yournal.controllers'
app.controller 'VisualizationController', [
  '$scope', controller
]<commit_msg>Visualization now uses actual article data<commit_after>controller = ($scope, Article) ->

  articlesPromise = Article.query()
  nodesList = []
  linksList = []
  authors = {}

  articlesPromise.$promise.then((articles) ->
    for article in articles
      articleNode = { "name": article.title, "group": 1 }
      target = nodesList.push(articleNode) - 1

      for author in article.authors
        console.log author
        if authors[author]?
          source = authors[author]
          console.log 'in'
        else
          authorNode = { "name": author, "group": 2 }
          source = nodesList.push(authorNode) - 1
          console.log 'out'
        linkNode = {"source": source,"target": target, "value": 1}
        linksList.push linkNode

    $scope.data = {
      nodes: nodesList
      links: linksList
    }
  )

app = angular.module 'yournal.controllers'
app.controller 'VisualizationController', [
  '$scope', 'Article', controller
]
{'fraction_non_alphanumeric': 0.23026926648096566, 'fraction_numerical': 0.031104921077065924, 'mean_word_length': 3.498956158663883, 'pattern_counts': {'":': 77, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '4881949', 'n_tokens_mistral': 710, 'n_tokens_neox': 695, 'n_words': 108}