<commit_before>import { SortPipe } from './../pipes/sort.pipe';
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Rx';

@Injectable()
export class GithubService {

  api: string = 'https://api.github.com/users/';
  params: string = '/events';
  users: any[] = [];
  usersContribusion: any[] = [];

  constructor(private http: Http, private sort: SortPipe) {
    this.users.push(
      'Gillespie59',
      'GwennaelBuchet',
      'T3kstiil3',
      'RemiEven',
      'looztra',
      'a-cordier',
      'wadendo',
      'NathanDM',
      'Antoinephi',
      'cluster',
      'yyekhlef',
      'gdrouet',
      'Kize'
    );
  }

  getTopContributors(){
    return Observable
      .from(this.users)
      .flatMap((users) => this.getUserContributions(users))
      .map((usersContri) => {
        let nbContributions = 0;

        usersContri
          .filter(contrib => contrib.type === 'PushEvent' && contrib.created_at.indexOf(this.getDate()) !== -1)
          .map(contri => nbContributions += contri.payload.commits.length);

        this.usersContribusion.push({
          user : usersContri[0].actor.display_login,
          contributions : nbContributions,
          avatar: usersContri[0].actor.avatar_url
        });
        return this.sort.transform(this.usersContribusion, 'contributions');
      });
  }

  getUserContributions(user){
    return this.http
      .get(this.api + user + this.params)
      .map(function(res){
        let response = res.json();
        return response;
      });
  }

  private getDate(){
    let today = new Date();
    return `${today.getFullYear()}-${("0" + (today.getMonth() + 1)).slice(-2)}`;
  }

}
<commit_msg>Get Contibutor name instead of username<commit_after>import { SortPipe } from './../pipes/sort.pipe';
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Rx';

@Injectable()
export class GithubService {

  api: string = 'https://api.github.com/users/';
  params: string = '/events';
  users: any[] = [];
  usersContribusion: any[] = [];

  constructor(private http: Http, private sort: SortPipe) {
    this.users.push(
      'Gillespie59',
      'GwennaelBuchet',
      'T3kstiil3',
      'RemiEven',
      'looztra',
      'a-cordier',
      'wadendo',
      'NathanDM',
      'Antoinephi',
      'cluster',
      'yyekhlef',
      'gdrouet',
      'Kize'
    );
  }

  getTopContributors() {
    return Observable
      .from(this.users)
      .flatMap(user => this.getUserInfo(user))
      .flatMap(user => this.getUserContributions(user))
      .map(contribsAndUser => {
        let nbContributions = 0;
        let contribs = contribsAndUser.contribs;

        contribs
          .filter(contrib => contrib.type === 'PushEvent' && contrib.created_at.indexOf(this.getDate()) !== -1)
          .map(contri => nbContributions += contri.payload.commits.length);

        this.usersContribusion.push({
          user: contribsAndUser.user.name,
          contributions: nbContributions,
          avatar: contribs[0].actor.avatar_url
        });
        return this.sort.transform(this.usersContribusion, 'contributions');
      });
  }

  getUserInfo(user: string) {
    return this.http.get(`${this.api}${user}`)
      .map(res => {
        let response = res.json();
        return {
          login: user,
          name: response['name']
        }
      });
  }

  getUserContributions(user) {
    return this.http
      .get(this.api + user.login + this.params)
      .map(res => {
        return {
          contribs: res.json(),
          user
        };
      });
  }

  private getDate() {
    let today = new Date();
    return `${today.getFullYear()}-${("0" + (today.getMonth() + 1)).slice(-2)}`;
  }

}

{'fraction_non_alphanumeric': 0.15918045705279749, 'fraction_numerical': 0.005516154452324665, 'mean_word_length': 2.4337240757439136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 2, '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': '1356306', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1247, 'n_words': 224}