<commit_before>app.stateChart.addState 'Data Feed',
  substatesAreConcurrent: yes
  parentState: 'Top'

  enterState: ->
    @sendEvent 'loadWeather'
    @sendEvent 'loadNews'
    @sendEvent 'loadTwitter'

  loadWeather: ->
    app.models.weather.once 'change', =>
      @sendEvent 'weatherLoaded'

    app.models.weather.fetch()

    # setup periodic collection update
    _updateWeather = ->
      app.intervals.ticket_refresh = setTimeout =>
        app.models.weather.once 'change', ->
          _updateWeather()
      , 600000

    _updateWeather()

  loadNews: ->
      app.collections.news.once 'sync', =>
        @sendEvent 'newsLoaded'

      app.collections.news.fetch()

    _updateNews = ->
      app.intervals.news_refresh = setTimeout =>
        app.collections.news_feed.once 'sync', ->
          app.views.news.render()
          _updateNews()
      , 600000

    _updateNews()

  loadTwitter: ->
      app.collections.twitter.once 'sync', =>
        @sendEvent 'twitterLoaded'

      app.collections.twitter.fetch()

    _updateTwitter = ->
      app.intervals.twitter_refresh = setTimeout =>
        app.collections.twitter_feed.once 'sync', ->
          app.views.twitter.render()
          _updateTwitter()
      , 600000

    _updateTwitter()

  weatherLoaded: ->
    {WeatherView} = require 'views/weather'
    app.views.weather = new WeatherView
      model: app.models.weather
    app.layouts.main.leftRegion.show app.views.weather
    
  newsLoaded: ->
    {NewsListView} = require 'views/news'
    app.views.news = new NewsListView
      collection: app.collections.news
    app.layouts.main.middleRegion.show app.views.news

  twitterLoaded: ->
    {TwitterView} = require 'views/twitter'
    app.views.twitter = new TwitterView
      collection: app.collections.twitter
    app.layouts.main.rightBottomRegion.show app.views.twitter<commit_msg>Actually refresh the feeds<commit_after>app.stateChart.addState 'Data Feed',
  substatesAreConcurrent: yes
  parentState: 'Top'

  enterState: ->
    @sendEvent 'loadWeather'
    @sendEvent 'loadNews'
    @sendEvent 'loadTwitter'

  loadWeather: ->
    app.models.weather.once 'change', =>
      @sendEvent 'weatherLoaded'

    app.models.weather.fetch()

    # setup periodic collection update
    _updateWeather = ->
      app.intervals.weather_refresh = setTimeout =>
        app.models.weather.once 'change', ->
          _updateWeather()
        app.models.weather.fetch()
      , 600000

    _updateWeather()

  loadNews: ->
      app.collections.news.once 'sync', =>
        @sendEvent 'newsLoaded'

      app.collections.news.fetch()

    _updateNews = ->
      app.intervals.news_refresh = setTimeout =>
        app.collections.news_feed.once 'sync', ->
          app.views.news.render()
          _updateNews()
        app.collections.news_feed.changes()
      , 600000

    _updateNews()

  loadTwitter: ->
      app.collections.twitter.once 'sync', =>
        @sendEvent 'twitterLoaded'

      app.collections.twitter.fetch()

    _updateTwitter = ->
      app.intervals.twitter_refresh = setTimeout =>
        app.collections.twitter_feed.once 'sync', ->
          app.views.twitter.render()
          _updateTwitter()
        app.collections.twitter_feed.changes()
      , 600000

    _updateTwitter()

  weatherLoaded: ->
    {WeatherView} = require 'views/weather'
    app.views.weather = new WeatherView
      model: app.models.weather
    app.layouts.main.leftRegion.show app.views.weather
    
  newsLoaded: ->
    {NewsListView} = require 'views/news'
    app.views.news = new NewsListView
      collection: app.collections.news
    app.layouts.main.middleRegion.show app.views.news

  twitterLoaded: ->
    {TwitterView} = require 'views/twitter'
    app.views.twitter = new TwitterView
      collection: app.collections.twitter
    app.layouts.main.rightBottomRegion.show app.views.twitter
{'fraction_non_alphanumeric': 0.11617722823286966, 'fraction_numerical': 0.00927357032457496, 'mean_word_length': 2.649436090225564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 41, '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': '5079815', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1149, 'n_words': 195}