<commit_before>define([
  'extensions/controllers/controller',
  'common/collections/services',
  'client/views/services'
], function (Controller, ServicesCollection, ServicesView) {
  return Controller.extend({
    collectionClass: ServicesCollection,
    viewClass: ServicesView,
    clientRenderOnInit: true,

    initialize: function() {
      this.listenTo(this.model, 'filterChanged', this.updateCollectionFilter);
    },

    updateCollectionFilter: function () {
      var filteredList = this.unfilteredCollection.filterServices({
        text: this.model.get('filter'),
        department: this.model.get('departmentFilter')
      });

      this.collection.reset(filteredList);
    },

    renderView: function (options) {
      this.unfilteredCollection = new ServicesCollection(this.collection.models, this.collection.options);

      options = _.extend({}, this.viewOptions(), options);
      if (!this.view) {
        this.view = new this.viewClass(options);
      }
      this.view.render();
      this.trigger('ready');
      this.trigger('loaded');
    },
    collectionData: function () {
      return this.model.get('data');
    },
    collectionOptions: function() {
      return this.model.get('axesOptions');
    },
    viewOptions: function () {
      return {
        el: '#content'
      };
    }
  });
});<commit_msg>Fix - update the services filter before rendering<commit_after>define([
  'extensions/controllers/controller',
  'common/collections/services',
  'client/views/services'
], function (Controller, ServicesCollection, ServicesView) {
  return Controller.extend({
    collectionClass: ServicesCollection,
    viewClass: ServicesView,
    clientRenderOnInit: true,

    initialize: function() {
      this.listenTo(this.model, 'filterChanged', this.updateCollectionFilter);
    },

    updateCollectionFilter: function () {
      var filteredList = this.unfilteredCollection.filterServices({
        text: this.model.get('filter'),
        department: this.model.get('departmentFilter')
      });

      this.collection.reset(filteredList);
    },

    renderView: function (options) {
      this.unfilteredCollection = new ServicesCollection(this.collection.models, this.collection.options);

      this.updateCollectionFilter();
      options = _.extend({}, this.viewOptions(), options);
      if (!this.view) {
        this.view = new this.viewClass(options);
      }
      this.view.render();
      this.trigger('ready');
      this.trigger('loaded');
    },
    collectionData: function () {
      return this.model.get('data');
    },
    collectionOptions: function() {
      return this.model.get('axesOptions');
    },
    viewOptions: function () {
      return {
        el: '#content'
      };
    }
  });
});
{'fraction_non_alphanumeric': 0.13664371148967017, 'fraction_numerical': 0.0, 'mean_word_length': 3.16289592760181, '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': '1765721', 'n_tokens_mistral': 754, 'n_tokens_neox': 735, 'n_words': 133}