<commit_before>/*jslint nomen: true */
/*globals define: true */

define([
  'jquery',
  'lib/lodash',
  'backbone',
  'settings',

  // Router
  'routers/index',

  // Models
  'models/surveys',

  // Views
  'views/surveys'

],

function($, _, Backbone, settings, IndexRouter, Surveys, SurveyViews) {
  'use strict';

  var DashboardView = Backbone.View.extend({
  
    el: '#container',
    
    initialize: function(options) {
      _.bindAll(this, 'render', 'appendSurvey');

      if (options) {
        this.el = options.el || '#container';
      }

      this.surveys = new Surveys.Collection();
      this.surveys.bind('reset', this.render);
    },

    update: function() {
      this.surveys.fetch();
    },
    
    render: function() {
      console.log("Rendering DashboardView");
      
      var self = this;
      var context = {};
      this.$el.html(_.template($('#dashboard').html(), context));

      this.surveys.each(function(survey) {
        self.appendSurvey(survey);
      });
    },<commit_msg>Reset the surveys collection when we create the dashboard view<commit_after>/*jslint nomen: true */
/*globals define: true */

define([
  'jquery',
  'lib/lodash',
  'backbone',
  'settings',

  // Router
  'routers/index',

  // Models
  'models/surveys',

  // Views
  'views/surveys'

],

function($, _, Backbone, settings, IndexRouter, Surveys, SurveyViews) {
  'use strict';

  var DashboardView = Backbone.View.extend({
  
    el: '#container',
    
    initialize: function(options) {
      _.bindAll(this, 'render', 'appendSurvey');

      if (options) {
        this.el = options.el || '#container';
      }

      this.surveys = new Surveys.Collection();
      this.surveys.bind('reset', this.render);
    },

    update: function() {
      this.surveys.fetch({
        reset: true
      });
    },
    
    render: function() {
      console.log("Rendering DashboardView");
      
      var self = this;
      var context = {};
      this.$el.html(_.template($('#dashboard').html(), context));

      this.surveys.each(function(survey) {
        self.appendSurvey(survey);
      });
    },
{'fraction_non_alphanumeric': 0.16635249764373233, 'fraction_numerical': 0.0, 'mean_word_length': 2.4975288303130148, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2068731', 'n_tokens_mistral': 713, 'n_tokens_neox': 691, 'n_words': 133}