<commit_before>(function(root) {
  window.shared || (window.shared = {});
  const Filters = window.shared.Filters;
  const Routes = window.shared.Routes;
  const styles = window.shared.styles;
  const colors = window.shared.colors;
  const merge = window.shared.ReactHelpers.merge;

  const StudentsTable = React.createClass({
    displayName: 'StudentsTable',

    propTypes: {
      students: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
    },

    componentDidMount: function() {
      new Tablesort(document.querySelector('.students-table'), { descending: false });
    },

    render: function() {
      return (
        <div className='StudentsTable'>
          <table className='students-table' style={{ width: '100%' }}>
            <thead>
              <tr>
                {this.renderHeader('Name', { className: 'sort-default' }) /* className is read by Tablesort */}
                {this.renderHeader('Grade')}
                {this.renderHeader('Disability', { 'data-sort-method': "disability" })}
                {this.renderHeader('Low Income')}
                {this.renderHeader('LEP')}
                {this.renderHeader('STAR Reading')}
                {this.renderHeader('MCAS ELA')}
                {this.renderHeader('STAR Math')}
                {this.renderHeader('MCAS Math')}
                {this.renderHeader('Discipline Incidents')}
                {this.renderHeader('Absences')}
                {this.renderHeader('Tardies')}
                {this.renderHeader('Services')}
                {this.renderHeader('Program', { 'data-sort-method': 'prog_assign_sort' })}
                {this.renderHeader('Homeroom')}
              </tr>
            </thead>
            <tbody>
              {this.props.students.map(function(student) {
                return (
                  <tr key={student.id}>
                    <td>
                      <a href={Routes.studentProfile(student.id)}>
                        {student.first_name + ' ' + student.last_name}
                      </a>
                    </td>
                    <td>
                      {student.grade}
                    </td>
                    <td>
                      {this.renderUnless('None', student.sped_level_of_need)}
                    </td>
                    <td style={{width: '2.5em'}}>
                      {this.renderUnless('Not Eligible', student.free_reduced_lunch)}
                    </td>
                    <td style={{width: '2.5em'}}>
                      {this.renderUnless('Fluent', student.limited_english_proficiency)}
                    </td>
                    {this.renderNumberCell(student.most_recent_star_reading_percentile)}
                    {this.renderNumberCell(student.most_recent_mcas_ela_scaled)}
                    {this.renderNumberCell(student.most_recent_star_math_percentile)}<commit_msg>Show date of last student SST Notes in School Overview Table<commit_after>(function(root) {
  window.shared || (window.shared = {});
  const Filters = window.shared.Filters;
  const Routes = window.shared.Routes;
  const styles = window.shared.styles;
  const colors = window.shared.colors;
  const merge = window.shared.ReactHelpers.merge;

  const StudentsTable = React.createClass({
    displayName: 'StudentsTable',

    propTypes: {
      students: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
    },

    componentDidMount: function() {
      new Tablesort(document.querySelector('.students-table'), { descending: false });
    },

    mergeInDateOfLastSST (student) {
      const eventNotes = student.event_notes;
      const sstNotes = eventNotes.filter((note) => {
        return note.event_note_type_id === 300 });

      if (sstNotes.length === 0) return merge(student, { dateOfLastSST: null });

      const sstNoteDates = sstNotes.map(note => moment.utc(note.recorded_at)).sort();
      const latestSstDate = _.last(sstNoteDates).format('M/D/YY');

      return merge(student, { dateOfLastSST: latestSstDate });
    },

    studentsWithDateOfLastSST () {
      return this.props.students.map(student => this.mergeInDateOfLastSST(student));
    },

    render: function() {
      return (
        <div className='StudentsTable'>
          <table className='students-table' style={{ width: '100%' }}>
            <thead>
              <tr>
                {this.renderHeader('Name', { className: 'sort-default' }) /* className is read by Tablesort */}
                {this.renderHeader('Last SST')}
                {this.renderHeader('Grade')}
                {this.renderHeader('Disability', { 'data-sort-method': "disability" })}
                {this.renderHeader('Low Income')}
                {this.renderHeader('LEP')}
                {this.renderHeader('STAR Reading')}
                {this.renderHeader('MCAS ELA')}
                {this.renderHeader('STAR Math')}
                {this.renderHeader('MCAS Math')}
                {this.renderHeader('Discipline Incidents')}
                {this.renderHeader('Absences')}
                {this.renderHeader('Tardies')}
                {this.renderHeader('Services')}
                {this.renderHeader('Program', { 'data-sort-method': 'prog_assign_sort' })}
                {this.renderHeader('Homeroom')}
              </tr>
            </thead>
            <tbody>
              {this.studentsWithDateOfLastSST().map(function(student) {
                return (
                  <tr key={student.id}>
                    <td>
                      <a href={Routes.studentProfile(student.id)}>
                        {student.first_name + ' ' + student.last_name}
                      </a>
                    </td>
                    <td>{student.dateOfLastSST}</td>
                    <td>{student.grade}</td>
                    <td>{this.renderUnless('None', student.sped_level_of_need)}</td>
                    <td style={{width: '2.5em'}}>{this.renderUnless('Not Eligible', student.free_reduced_lunch)}</td>
                    <td style={{width: '2.5em'}}>{this.renderUnless('Fluent', student.limited_english_proficiency)}</td>
                    {this.renderNumberCell(student.most_recent_star_reading_percentile)}
                    {this.renderNumberCell(student.most_recent_mcas_ela_scaled)}
                    {this.renderNumberCell(student.most_recent_star_math_percentile)}
{'fraction_non_alphanumeric': 0.13451856513530522, 'fraction_numerical': 0.0028319697923222154, 'mean_word_length': 1.9567441860465116, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 48, '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': '4664535', 'n_tokens_mistral': 1848, 'n_tokens_neox': 1730, 'n_words': 263}