<commit_before>import React from 'react';
import PropTypes from 'prop-types';

import DashboardHelpers from '../DashboardHelpers';
import SchoolwideAttendance from './SchoolwideAttendance';
import {apiFetchJson} from '../../../helpers/apiFetchJson';

class SchoolwideAbsences extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      dashboardStudents: this.props.dashboardStudents,
      isLoading: false
    };
  }

  componentWillMount() {
    if(this.props.dashboardStudents.length) return;
    const url = `/schools/${this.props.schoolId}/absence_dashboard_data`;
    this.setState({isLoading: true});

    apiFetchJson(url)
      .then(response => { return response; })
      .then(response => { this.setState({dashboardStudents: response, isLoading: false}); });
  }

  render() {
    const {dashboardStudents, isLoading} = this.state;

    if (isLoading) {
      return <p>Loading ...</p>;
    }

    return (
        <SchoolwideAttendance
          schoolAbsenceEvents = {DashboardHelpers.absenceEventsByDay(dashboardStudents)}
          dashboardStudents = {this.state.dashboardStudents}/>);
  }
}

SchoolwideAbsences.propTypes = {
  dashboardStudents: PropTypes.array.isRequired,
  schoolId: PropTypes.number
};

export default SchoolwideAbsences;<commit_msg>unnecessary render<commit_after>import React from 'react';
import PropTypes from 'prop-types';

import DashboardHelpers from '../DashboardHelpers';
import SchoolwideAttendance from './SchoolwideAttendance';
import {apiFetchJson} from '../../../helpers/apiFetchJson';

class SchoolwideAbsences extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      dashboardStudents: this.props.dashboardStudents,
      isLoading: false
    };
  }

  componentWillMount() {
    if(this.props.dashboardStudents.length) return;
    const url = `/schools/${this.props.schoolId}/absence_dashboard_data`;
    this.setState({isLoading: true});

    apiFetchJson(url)
      .then(response => { this.setState({dashboardStudents: response, isLoading: false}); });
  }

  render() {
    const {dashboardStudents, isLoading} = this.state;

    if (isLoading) {
      return <p>Loading ...</p>;
    }

    return (
        <SchoolwideAttendance
          schoolAbsenceEvents = {DashboardHelpers.absenceEventsByDay(dashboardStudents)}
          dashboardStudents = {this.state.dashboardStudents}/>);
  }
}

SchoolwideAbsences.propTypes = {
  dashboardStudents: PropTypes.array.isRequired,
  schoolId: PropTypes.number
};

export default SchoolwideAbsences;
{'fraction_non_alphanumeric': 0.1246591351772497, 'fraction_numerical': 0.0, 'mean_word_length': 3.854442344045369, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, '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': '540310', 'n_tokens_mistral': 751, 'n_tokens_neox': 761, 'n_words': 141}