<commit_before>import { Component, OnDestroy, OnInit } from '@angular/core';
import { Router } from '@angular/router';

import { TournamentService } from 'app/services/api/tournament.service';
import { ITournament } from 'app/services/model/ITournament';
import { TranslateService } from "@ngx-translate/core";

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit, OnDestroy {
  types = [];
  current = [];
  isLoading: boolean = true;

  constructor(private tournamentService: TournamentService, private translate: TranslateService) {
    tournamentService.upcoming().subscribe(tournaments => this.types.push({ name: 'Future', tournaments: tournaments }));
    tournamentService.past().subscribe(tournaments => this.types.push({ name: 'Past', tournaments: tournaments }));
    tournamentService.current().subscribe(tournaments => this.current = tournaments);
  }

  ngOnInit() { }

  ngOnDestroy() {
    this.tournamentService.selectedId = null;
    this.tournamentService.selected = null;
  }
}<commit_msg>Sorted tournaments in list<commit_after>import { Component, OnDestroy, OnInit } from '@angular/core';
import { Router } from '@angular/router';

import { TournamentService } from 'app/services/api/tournament.service';
import { ITournament } from 'app/services/model/ITournament';
import { TranslateService } from "@ngx-translate/core";

type tournamentType = {name: string, tournaments: ITournament[]};

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit, OnDestroy {
  _types: tournamentType[] = [];
  get types() { return this._types.sort((a: tournamentType, b: tournamentType) => (a.name === 'Future') ? -1 : 1); } // Future first, allways
  current = [];
  isLoading: boolean = true;

  constructor(private tournamentService: TournamentService, private translate: TranslateService) {
    tournamentService.upcoming().subscribe(tournaments => this._types.push({ name: 'Future', tournaments: tournaments }));
    tournamentService.past().subscribe(tournaments => this._types.push({ name: 'Past', tournaments: tournaments }));
    tournamentService.current().subscribe(tournaments => this.current = tournaments);
  }

  ngOnInit() { }

  ngOnDestroy() {
    this.tournamentService.selectedId = null;
    this.tournamentService.selected = null;
  }
}
{'fraction_non_alphanumeric': 0.1449859041482078, 'fraction_numerical': 0.0008054772452678212, 'mean_word_length': 5.17910447761194, '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': '2635130', 'n_tokens_mistral': 722, 'n_tokens_neox': 693, 'n_words': 158}