<commit_before>import Ember from "ember";

const sortFunctions = {
  name: function (a, b) {
    return a.get('event_name').toLowerCase().localeCompare(b.get('event_name').toLowerCase());
  },
  url: function (a, b) {
    return a.get('url').localeCompare(b.get('url'));
  },
  version: function (a, b) {
    return a.get('osversion.id') - b.get('osversion.id');
  },
  status: function (a, b) {
    let state = a.get('state');
    let state2 = b.get('state');
    return state ? state.localeCompare(state2) : -1;
  }
};

export default Ember.Component.extend({
  sortAscending: true,
  savedInstances: Ember.computed.filter('model', function (instance) {
    return !!instance.get('slug');
  }),
  sortedProperties: ['name'],
  filteredInstances: Ember.computed('savedInstances.[]', 'filteredVersion', function () {
    const savedInstances = this.get('savedInstances');
    const filtedVersion = this.get('filteredVersion');
    return savedInstances.filter(function(instance) {
      if(!filtedVersion) {
        return true;
      }
      return instance.get('osversion') === filtedVersion;
    });
  }),
  sortedInstances: Ember.computed('filteredInstances.@each', 'sortedProperties.@each', 'sortAscending', function () {
    let sortedProperty = this.get('sortedProperties')[0];
    let fnCompare = this.get('sortAscending') ?
      function (a, b) {
        return sortFunctions[sortedProperty](a, b);<commit_msg>Match instance version by id instead of version object equality<commit_after>import Ember from "ember";

const sortFunctions = {
  name: function (a, b) {
    return a.get('event_name').toLowerCase().localeCompare(b.get('event_name').toLowerCase());
  },
  url: function (a, b) {
    return a.get('url').localeCompare(b.get('url'));
  },
  version: function (a, b) {
    return a.get('osversion.id') - b.get('osversion.id');
  },
  status: function (a, b) {
    let state = a.get('state');
    let state2 = b.get('state');
    return state ? state.localeCompare(state2) : -1;
  }
};

export default Ember.Component.extend({
  sortAscending: true,
  savedInstances: Ember.computed.filter('model', function (instance) {
    return !!instance.get('slug');
  }),
  sortedProperties: ['name'],
  filteredInstances: Ember.computed('savedInstances.[]', 'filteredVersion', function () {
    const savedInstances = this.get('savedInstances');
    const filtedVersion = this.get('filteredVersion');
    return savedInstances.filter(function(instance) {
      if(!filtedVersion) {
        return true;
      }
      return instance.get('osversion.id') === filtedVersion.get('id');
    });
  }),
  sortedInstances: Ember.computed('filteredInstances.@each', 'sortedProperties.@each', 'sortAscending', function () {
    let sortedProperty = this.get('sortedProperties')[0];
    let fnCompare = this.get('sortAscending') ?
      function (a, b) {
        return sortFunctions[sortedProperty](a, b);
{'fraction_non_alphanumeric': 0.16672407853944196, 'fraction_numerical': 0.002755769893213917, 'mean_word_length': 4.130742049469965, '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': '6807015', 'n_tokens_mistral': 914, 'n_tokens_neox': 917, 'n_words': 182}