<commit_before>/**
 * Copyright 2015 <NAME>
 */

var _ = require('underscore'),
    Backbone = require('backbone'),
    ControlBones = require('./ControlBones'),

    // Model
    TableRowModel = require('../model/table/TableRowModel'),

    // Views
    SummaryBlock = require('../view/SummaryBlock'),
    TableView = require('../view/table/TableView'),
    TableRow = require('../view/table/TableRow'),
    TextCell = require('../view/table/cell/TextCell');

var EntryListController = ControlBones.extend({
   title: 'Entry List',
   columns: { },

   // Views
   summaryBlock: null,  // SummaryBlock
   table: null,  // TableView

   /**
    * @param collection AmountEntryCollection
    * @return SummaryBlock
    */
   render: function(collection) {
      var self = this;

      // Assemble summary block
      this.summaryBlock = new SummaryBlock({
         model: this._createSummaryModel()
      });

      this.table = new TableView({
         collection: this._createTableCollection(collection),
         childViewOptions: {
            prependCellType: null,
            cellType: TextCell,
            appendCellType: null
         },
         header: this._generateHeader()
      });

      this.summaryBlock.on('show', function() {
        self.summaryBlock.content.show(self.table);
      });

      return this.summaryBlock;
   },

   _generateHeader: function() {
      return new TableRow({
         model: new Backbone.Model({
            'members': new Backbone.Collection(
               _.map(_.keys(this.columns), function(name) {
                  return { 'text': name };
               }),
               Backbone.Model.extend({
                  'text': ''
               })<commit_msg>Add sorting for entry list<commit_after>/**
 * Copyright 2015 <NAME>
 */

var _ = require('underscore'),
    Backbone = require('backbone'),
    ControlBones = require('./ControlBones'),

    // Model
    TableRowModel = require('../model/table/TableRowModel'),

    // Views
    SummaryBlock = require('../view/SummaryBlock'),
    TableView = require('../view/table/TableView'),
    TableRow = require('../view/table/TableRow'),
    TextCell = require('../view/table/cell/TextCell');

var EntryListController = ControlBones.extend({
   title: 'Entry List',
   columns: { },

   // Views
   summaryBlock: null,  // SummaryBlock
   table: null,  // TableView

   /**
    * @param collection AmountEntryCollection
    * @return SummaryBlock
    */
   render: function(collection) {
      var self = this;

      // Assemble summary block
      this.summaryBlock = new SummaryBlock({
         model: this._createSummaryModel()
      });

      // Sort our collection
      collection.comparator = function(model) {
         return [model.get('date'), model.get('note'), model.get('amount').get()];
      };
      collection.sort();

      this.table = new TableView({
         collection: this._createTableCollection(collection),
         childViewOptions: {
            prependCellType: null,
            cellType: TextCell,
            appendCellType: null
         },
         header: this._generateHeader()
      });

      this.summaryBlock.on('show', function() {
        self.summaryBlock.content.show(self.table);
      });

      return this.summaryBlock;
   },

   _generateHeader: function() {
      return new TableRow({
         model: new Backbone.Model({
            'members': new Backbone.Collection(
               _.map(_.keys(this.columns), function(name) {
                  return { 'text': name };
               }),
               Backbone.Model.extend({
                  'text': ''
               })
{'fraction_non_alphanumeric': 0.13806380638063806, 'fraction_numerical': 0.0022002200220022, 'mean_word_length': 2.12725709372313, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3853468', 'n_tokens_mistral': 999, 'n_tokens_neox': 963, 'n_words': 196}