<commit_before>import React from 'react';

import moment from 'moment';
import ActivityIconWithTooltip from '../general_components/activity_icon_with_tooltip.jsx';
import activityLaunchLink from '../modules/generate_activity_launch_link.js';

export default React.createClass({
  propTypes: {
    data: React.PropTypes.object.isRequired,
  },

  renderDueDate() {
    return this.props.data.due_date ? <span className="due-date">{moment(this.props.data.due_date).format('MM-DD-YYYY')}</span> : <span />;
  },

  dataForActivityIconWithToolTip() {
    return {
      percentage: this.props.data.max_percentage,
      activity_classification_id: this.props.data.activity_classification_id,
    };
  },

  renderStartButtonOrLockMessage() {
    let linkText;
    if (this.props.data.repeatable === 'f' && this.props.data.max_percentage) {
      return (<p className="title-v-centered text-right">Completed</p>);
    } else if (this.props.data.locked === 't') {
      return (<p className="title-v-centered text-right" style={{ color: '#969696', }}>Locked by teacher</p>);
    } else if (this.props.data.max_percentage) {
      linkText = 'Replay Activity';
    } else if (this.props.data.resume_link === '1' && this.props.data.activity_classification_id === '6') {
      linkText = 'Join Lesson';
    } else if (this.props.data.resume_link === '1') {
      linkText = 'Resume Activity';
    } else if (this.props.data.activity_classification_id === '6') {
      linkText = 'Join Lesson';
    } else {
      linkText = 'Start Activity';
    }
    return <a href={activityLaunchLink(this.props.data.ca_id)}>{linkText}</a>;
  },

  render() {
    return (
      <div className="line">
        <div className="row">
          <div className="col-xs-8 col-sm-9 col-xl-9 pull-left">
            <ActivityIconWithTooltip data={this.dataForActivityIconWithToolTip()} context={'studentProfile'} />
            <div className="icons-description-wrapper">
              <p className="title title-v-centered">{this.props.data.name}</p>
            </div>
          </div>
          <span className="row-list-end">
            {this.renderDueDate()}
            {this.renderStartButtonOrLockMessage()}
          </span>
        </div>
      </div>
    );
  },
});<commit_msg>Simplify logic in StudentProfileActivity component<commit_after>import React from 'react';

import moment from 'moment';
import ActivityIconWithTooltip from '../general_components/activity_icon_with_tooltip.jsx';
import activityLaunchLink from '../modules/generate_activity_launch_link.js';

export default React.createClass({
  propTypes: {
    data: React.PropTypes.object.isRequired,
  },

  renderDueDate() {
    return this.props.data.due_date ? <span className="due-date">{moment(this.props.data.due_date).format('MM-DD-YYYY')}</span> : <span />;
  },

  dataForActivityIconWithToolTip() {
    return {
      percentage: this.props.data.max_percentage,
      activity_classification_id: this.props.data.activity_classification_id,
    };
  },

  renderStartButtonOrLockMessage() {
    let linkText;
    if (this.props.data.repeatable === 'f' && this.props.data.max_percentage) {
      return (<p className="title-v-centered text-right">Completed</p>);
    } else if (this.props.data.locked === 't') {
      return (<p className="title-v-centered text-right" style={{ color: '#969696', }}>Locked by teacher</p>);
    } else if (this.props.data.max_percentage) {
      linkText = 'Replay Activity';
    } else if (this.props.data.activity_classification_id === '6') {
      linkText = 'Join Lesson';
    } else if (this.props.data.resume_link === '1') {
      linkText = 'Resume Activity';
    } else {
      linkText = 'Start Activity';
    }
    return <a href={activityLaunchLink(this.props.data.ca_id)}>{linkText}</a>;
  },

  render() {
    return (
      <div className="line">
        <div className="row">
          <div className="col-xs-8 col-sm-9 col-xl-9 pull-left">
            <ActivityIconWithTooltip data={this.dataForActivityIconWithToolTip()} context={'studentProfile'} />
            <div className="icons-description-wrapper">
              <p className="title title-v-centered">{this.props.data.name}</p>
            </div>
          </div>
          <span className="row-list-end">
            {this.renderDueDate()}
            {this.renderStartButtonOrLockMessage()}
          </span>
        </div>
      </div>
    );
  },
});
{'fraction_non_alphanumeric': 0.15583238958097395, 'fraction_numerical': 0.005436013590033975, 'mean_word_length': 3.127102803738318, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, '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': '2773865', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1363, 'n_words': 241}