<commit_before>import React from 'react';
import { connect } from 'react-redux';
import Login from '../login/login.jsx';
import {Leaderboard} from './leaderboard.jsx';
import axios from 'axios';
import {List, ListItem} from 'material-ui/List';
import * as Utils from '../utils/utils.js';
import Avatar from 'material-ui/Avatar';
import Chip from 'material-ui/Chip';
import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn} from 'material-ui/Table';

const h3Style = {
  textAlign: 'center'
};
const styles = {
  chip: {
    margin: 4,
  },
  wrapper: {
    display: 'flex',
    flexWrap: 'wrap',
  },
};

class displayProfile extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      leaderboardList : [{rank:3,username: 'blake',favoriteActivity:'basketball',origin:'Houston'}]

    }
  };

  determinePicture(rank) {
    var url = ''
    if (rank === 1) {
      url = 'http://i.imgur.com/ciDDBOz.png';
    }
    if (rank === 2) {
      url = 'http://i.imgur.com/Zs7l8AD.png';
    }
    if (rank === 3) {
      url = 'http://i.imgur.com/t9YI38e.png';
    }
    if (rank === 4) {
      url = 'http://i.imgur.com/nvkleuQ.png';
    }
    if (rank === 5) {
      url = 'http://i.imgur.com/NO29rvV.png';
    }
    if (rank === 6) {
      url = 'http://i.imgur.com/XLicDQr.png';
    }
    if (rank === 7) {
      url = 'http://i.imgur.com/8OTPb7g.png';
    }
    if (rank === 8) {
      url = 'http://i.imgur.com/RAn6owu.png';
    }
    if (rank === 9) {
      url = 'http://i.imgur.com/weaQxmK.png';
    }
    if (rank === 10) {
      url = 'http://i.imgur.com/xwSRDv4.png';
    }
    return url;
  }

  componentWillMount(){
    var context = this;
    axios.get('/api/users')
  .then(function (response) {

    var list = response.data;
    list = list.sort(function(a, b){
      return a.rank > b.rank;
    }).slice(0,10);
    list = list.reverse();
    context.setState({

      leaderboardList : list
    })


  })
  .catch(function (error) {
    console.log(error);
  });

    }

  render(){

    return(<div><Table style={{width: '85%'}}><commit_msg>fixed the sort on the leaderboard<commit_after>import React from 'react';
import { connect } from 'react-redux';
import Login from '../login/login.jsx';
import {Leaderboard} from './leaderboard.jsx';
import axios from 'axios';
import {List, ListItem} from 'material-ui/List';
import * as Utils from '../utils/utils.js';
import Avatar from 'material-ui/Avatar';
import Chip from 'material-ui/Chip';
import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn} from 'material-ui/Table';

const h3Style = {
  textAlign: 'center'
};
const styles = {
  chip: {
    margin: 4,
  },
  wrapper: {
    display: 'flex',
    flexWrap: 'wrap',
  },
};

class displayProfile extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      leaderboardList : [{rank:3,username: 'blake',favoriteActivity:'basketball',origin:'Houston'}]

    }
  };

  determinePicture(rank) {
    var url = ''
    if (rank === 1) {
      url = 'http://i.imgur.com/ciDDBOz.png';
    }
    if (rank === 2) {
      url = 'http://i.imgur.com/Zs7l8AD.png';
    }
    if (rank === 3) {
      url = 'http://i.imgur.com/t9YI38e.png';
    }
    if (rank === 4) {
      url = 'http://i.imgur.com/nvkleuQ.png';
    }
    if (rank === 5) {
      url = 'http://i.imgur.com/NO29rvV.png';
    }
    if (rank === 6) {
      url = 'http://i.imgur.com/XLicDQr.png';
    }
    if (rank === 7) {
      url = 'http://i.imgur.com/8OTPb7g.png';
    }
    if (rank === 8) {
      url = 'http://i.imgur.com/RAn6owu.png';
    }
    if (rank === 9) {
      url = 'http://i.imgur.com/weaQxmK.png';
    }
    if (rank === 10) {
      url = 'http://i.imgur.com/xwSRDv4.png';
    }
    return url;
  }

  componentWillMount(){
    var context = this;
    axios.get('/api/users')
  .then(function (response) {

    var list = response.data;
    list = list.sort(function(a, b){
      return a.rank > b.rank;
    });
    list = list.reverse().slice(0,10);
    context.setState({

      leaderboardList : list
    })


  })
  .catch(function (error) {
    console.log(error);
  });

    }

  render(){

    return(<div><Table style={{width: '85%'}}>
{'fraction_non_alphanumeric': 0.18841262364578426, 'fraction_numerical': 0.01413094677343382, 'mean_word_length': 2.504125412541254, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '812475', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1561, 'n_words': 313}