<commit_before>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

//Import Actions
import { getCourseData } from './AssignmentsActions'
import {redirectReset} from './components/CreateAssignment/CreateAssignmentActions';
import RaisedButton from 'material-ui/FlatButton';

// Import Components
import Category from './modules/Category/Category';
// Import Bootstrap
import { GridList } from 'material-ui/GridList';
import Subheader from 'material-ui/Subheader';

export class Assignments extends Component {
  constructor(props) {
    super(props);
    this.state = { render: false, categories: [] };
  }

  componentDidMount() {
    this.props.getCourseData(this.props.params.course);
    this.setState({ render: false, categories: [] });
  }

  componentWillReceiveProps(nextProps) {
    this.categories = [];
    for (var i = 0; i < nextProps.assignments.length; ++i) {
      if (this.categories[nextProps.assignments[i].category] == undefined) {
        this.categories[nextProps.assignments[i].category] = [];
      }
      this.categories[nextProps.assignments[i].category].push(nextProps.assignments[i]);
    }
    this.setState({ render: true, categories: this.categories });

  }

  render() {
    var childComp = this.props.children;
    if (this.state.render && this.props.children) { return(<div>{childComp}</div>); }
    if(!this.state.render) {return null;}
    var cats = [];
    for (var key in this.state.categories) {
      cats.push(<Category key={this.state.categories[key][0].category} name={this.state.categories[key][0].category} location={this.props.location.pathname} assignments={this.state.categories[key]} />);
    }
    if(this.props.redirected){
      this.props.getCourseData(this.props.params.course);
      this.props.resetRedir();
    }
    return (
      <div>
        <RaisedButton labelStyle={{color:"white"}} backgroundColor="#005BBB" label="Create Assignment" onClick={()=>{window.location = (window.location.charAt(window.location.length - 1) != "/") ? window.location + "/create" : window.location.subStr(-1) + "create"}} /><commit_msg>lol just kidding now the button works<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

//Import Actions
import { getCourseData } from './AssignmentsActions'
import {redirectReset} from './components/CreateAssignment/CreateAssignmentActions';
import RaisedButton from 'material-ui/FlatButton';

// Import Components
import Category from './modules/Category/Category';
// Import Bootstrap
import { GridList } from 'material-ui/GridList';
import Subheader from 'material-ui/Subheader';

export class Assignments extends Component {
  constructor(props) {
    super(props);
    this.state = { render: false, categories: [] };
  }

  componentDidMount() {
    this.props.getCourseData(this.props.params.course);
    this.setState({ render: false, categories: [] });
  }

  componentWillReceiveProps(nextProps) {
    this.categories = [];
    for (var i = 0; i < nextProps.assignments.length; ++i) {
      if (this.categories[nextProps.assignments[i].category] == undefined) {
        this.categories[nextProps.assignments[i].category] = [];
      }
      this.categories[nextProps.assignments[i].category].push(nextProps.assignments[i]);
    }
    this.setState({ render: true, categories: this.categories });

  }

  render() {
    var childComp = this.props.children;
    if (this.state.render && this.props.children) { return(<div>{childComp}</div>); }
    if(!this.state.render) {return null;}
    var cats = [];
    for (var key in this.state.categories) {
      cats.push(<Category key={this.state.categories[key][0].category} name={this.state.categories[key][0].category} location={this.props.location.pathname} assignments={this.state.categories[key]} />);
    }
    if(this.props.redirected){
      this.props.getCourseData(this.props.params.course);
      this.props.resetRedir();
    }
    return (
      <div>
        <RaisedButton labelStyle={{color:"white"}} backgroundColor="#005BBB" label="Create Assignment" onClick={()=>{window.location = (window.location.toString().charAt(window.location.toString().length - 1) != "/") ? window.location + "/create" : window.location.toString().substring(-1) + "create"}} />
{'fraction_non_alphanumeric': 0.15754673962608298, 'fraction_numerical': 0.00364797081623347, 'mean_word_length': 4.210213776722091, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '7576825', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1281, 'n_words': 246}