<commit_before>import React from 'react';
import Editable from '../high_order/editable.jsx';

import List from '../common/list.jsx';
import Student from './student.jsx';
import StudentDrawer from './student_drawer.jsx';
import EnrollButton from './enroll_button.jsx';

import UserStore from '../../stores/user_store.js';
import AssignmentStore from '../../stores/assignment_store.js';
import ServerActions from '../../actions/server_actions.js';
import CourseUtils from '../../utils/course_utils.js';

const getState = () =>
  ({
    users: UserStore.getFiltered({ role: 0 }),
    assignments: AssignmentStore.getModels()
  })
;

// FIXME: Remove this save function
const save = () => {
  return null;
};

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

  propTypes: {
    course_id: React.PropTypes.string,
    users: React.PropTypes.array,
    course: React.PropTypes.object,
    controls: React.PropTypes.func,
    editable: React.PropTypes.bool
  },

  notify() {
    if (confirm(I18n.t('wiki_edits.notify_overdue.confirm'))) {
      return ServerActions.notifyOverdue(this.props.course_id);
    }
  },

  render() {
    const users = this.props.users.map(student => {
      const assignOptions = { user_id: student.id, role: 0 };
      const reviewOptions = { user_id: student.id, role: 1 };
      if (student.real_name) {
        const nameParts = student.real_name.split(' ');
        student.first_name = nameParts[0];
        student.last_name = nameParts.slice().pop();
      }

      return (
        <Student {...this.props}
          student={student}
          key={student.id}
          assigned={AssignmentStore.getFiltered(assignOptions)}
          reviewing={AssignmentStore.getFiltered(reviewOptions)}
        />
      );
    });

    const drawers = this.props.users.map(student => {
      return (
        <StudentDrawer
          student={student}
          course_id={this.props.course.id}
          key={`${student.id}_drawer`}
          ref={`${student.id}_drawer`}
        />
      );
    });
    let elements = _.flatten(_.zip(users, drawers));

    let addStudent;
    if (this.props.course.published) {
      addStudent = <EnrollButton {...this.props} role={0} key="add_student" allowed={false} />;
    }

    let notifyOverdue;
    if (this.props.users.length > 0 && (this.props.course.student_count - this.props.course.trained_count) > 0) {
      notifyOverdue = <button className="notify_overdue" onClick={this.notify} key="notify"></button>;
    }

    let keys = {
      username: {
        label: I18n.t('users.name'),
        desktop_only: false
      },
      assignment_title: {<commit_msg>Hide "notify untrained" for non-Wiki Ed instances<commit_after>import React from 'react';
import Editable from '../high_order/editable.jsx';

import List from '../common/list.jsx';
import Student from './student.jsx';
import StudentDrawer from './student_drawer.jsx';
import EnrollButton from './enroll_button.jsx';

import UserStore from '../../stores/user_store.js';
import AssignmentStore from '../../stores/assignment_store.js';
import ServerActions from '../../actions/server_actions.js';
import CourseUtils from '../../utils/course_utils.js';

const getState = () =>
  ({
    users: UserStore.getFiltered({ role: 0 }),
    assignments: AssignmentStore.getModels()
  })
;

// FIXME: Remove this save function
const save = () => {
  return null;
};

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

  propTypes: {
    course_id: React.PropTypes.string,
    users: React.PropTypes.array,
    course: React.PropTypes.object,
    controls: React.PropTypes.func,
    editable: React.PropTypes.bool
  },

  notify() {
    if (confirm(I18n.t('wiki_edits.notify_overdue.confirm'))) {
      return ServerActions.notifyOverdue(this.props.course_id);
    }
  },

  render() {
    const users = this.props.users.map(student => {
      const assignOptions = { user_id: student.id, role: 0 };
      const reviewOptions = { user_id: student.id, role: 1 };
      if (student.real_name) {
        const nameParts = student.real_name.split(' ');
        student.first_name = nameParts[0];
        student.last_name = nameParts.slice().pop();
      }

      return (
        <Student {...this.props}
          student={student}
          key={student.id}
          assigned={AssignmentStore.getFiltered(assignOptions)}
          reviewing={AssignmentStore.getFiltered(reviewOptions)}
        />
      );
    });

    const drawers = this.props.users.map(student => {
      return (
        <StudentDrawer
          student={student}
          course_id={this.props.course.id}
          key={`${student.id}_drawer`}
          ref={`${student.id}_drawer`}
        />
      );
    });
    let elements = _.flatten(_.zip(users, drawers));

    let addStudent;
    if (this.props.course.published) {
      addStudent = <EnrollButton {...this.props} role={0} key="add_student" allowed={false} />;
    }

    let notifyOverdue;
    if (Features.wikiEd && this.props.users.length > 0 && (this.props.course.student_count - this.props.course.trained_count) > 0) {
      notifyOverdue = <button className="notify_overdue" onClick={this.notify} key="notify"></button>;
    }

    let keys = {
      username: {
        label: I18n.t('users.name'),
        desktop_only: false
      },
      assignment_title: {
{'fraction_non_alphanumeric': 0.14933731566175099, 'fraction_numerical': 0.004106776180698152, 'mean_word_length': 2.835361488904796, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, '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': '5904648', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1649, 'n_words': 315}