<commit_before>import Ember from 'ember';

export default Ember.Component.extend({
  rounds: function() {
    const matches = this.get('matches');
    let rounds = [];

    const allRoundsOption = {
      id:   0,
      text: 'All rounds'
    };

    matches.forEach( (match) => {
      const round = match.get('round');

      // if property exists and doesn't saved in result array
      if (!round || rounds.contains(round)) {
        return false;
      }

      rounds.push(round);
    } );

    // format for select-2
    let roundsForSelect = rounds.map( (round) => {
      return {
        id:   round,
        text: round
      };
    } );

    roundsForSelect.unshift(allRoundsOption);

    return roundsForSelect;
  }.property('matches'),

  // set score variable for each match
  matchesList: function() {
    const matches = this.get('matches');

    return matches.map( (match) => {
      const score = this.getMatchScore(match);

      match.set('score', score);

      return match;
    } );
  }.property('matches'),

  getMatchScore(match) {
    const homeScore = (match.get('status') !== 'not_started') ? match.get('homeScore') : '-';
    const awayScore = (match.get('status') !== 'not_started') ? match.get('awayScore') : '-';

    return `${homeScore} : ${awayScore}`;
  }
});<commit_msg>Implemented filter by round in matches collection<commit_after>import Ember from 'ember';

export default Ember.Component.extend({
  selectedRound: {
    id: -1
  },

  rounds: function() {
    const matches = this.get('matches');
    let rounds = [];

    const allRoundsOption = {
      id:   -1,
      text: 'All rounds'
    };

    matches.forEach( (match) => {
      const round = match.get('round');

      // if property exists and doesn't saved in result array
      if (!round || rounds.contains(round)) {
        return false;
      }

      rounds.push(round);
    } );

    // format for select-2
    let roundsForSelect = rounds.map( (round) => {
      return {
        id:   round,
        text: round
      };
    } );

    roundsForSelect.unshift(allRoundsOption);

    return roundsForSelect;
  }.property('matches'),

  matchesList: function() {
    const matches = this.get('matches');
    const selectedRound = this.get('selectedRound.id');

    return matches
      .filter( (match) => {
        // use round filter
        if (selectedRound === -1) {
          return true;
        }

        return match.get('round') === selectedRound;
      } )
      .map( (match) => {
        // set score variable for each match
        const score = this.getMatchScore(match);

        match.set('score', score);

        return match;
    } );
  }.property('matches', 'selectedRound'),

  getMatchScore(match) {
    const homeScore = (match.get('status') !== 'not_started') ? match.get('homeScore') : '-';
    const awayScore = (match.get('status') !== 'not_started') ? match.get('awayScore') : '-';

    return `${homeScore} : ${awayScore}`;
  }
});
{'fraction_non_alphanumeric': 0.15646029609690443, 'fraction_numerical': 0.002018842530282638, 'mean_word_length': 2.461001164144354, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '2146953', 'n_tokens_mistral': 907, 'n_tokens_neox': 872, 'n_words': 213}