<commit_before>"use strict";

import React  from "react";

import * as AssessmentActions  from "../../actions/assessment";
import UniversalInput          from "./universal_input";

export default class Item extends React.Component{

  static propTypes = {
    // Assessment configuration settings. these should never be modified.
    settings          : React.PropTypes.object,

    // Item to be displayed
    question          : React.PropTypes.object.isRequired,

    // Array of selected answer IDs
    response          : React.PropTypes.array.isRequired,

    // The position of the item in the array of items
    currentItemIndex  : React.PropTypes.number.isRequired,

    // The total number of items in the array of items
    questionCount     : React.PropTypes.number.isRequired,

    // Graded user response object containing keys
    // correct:true/false, feedback:"Answer feedback"
    questionResult   : React.PropTypes.object.isRequired,

    selectAnswer      : React.PropTypes.func.isRequired,

    // User facing strings of the language specified by the 'locale' setting
    localizedStrings: React.PropTypes.object.isRequired
  };

  getFeedback(){
    var response = this.props.questionResult;

    if(response){

      if(response.correct === true){
        return (
          <div className="c-question-feedback  c-feedback--correct">
            <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
              <path d="M24 4C12.95 4 4 12.95 4 24c0 11.04 8.95 20 20 20 11.04 0 20-8.96 20-20 0-11.05-8.96-20-20-20zm-4 30L10 24l2.83-2.83L20 28.34l15.17-15.17L38 16 20 34z"/>
            </svg>
            <div
              dangerouslySetInnerHTML={{__html:response.feedback}}>
            </div>
          </div>
        );
      } else if(response.correct === false) {
        return (
          <div className="c-question-feedback  c-feedback--incorrect">
            <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
              <path d="M24 4c-11.05 0-20 8.95-20 20s8.95 20 20 20 20-8.95 20-20-8.95-20-20-20zm10 27.17l-2.83 2.83-7.17-7.17-7.17 7.17-2.83-2.83 7.17-7.17-7.17-7.17 2.83-2.83 7.17 7.17 7.17-7.17 2.83 2.83-7.17 7.17 7.17 7.17z"/>
            </svg>
            <div
              dangerouslySetInnerHTML={{__html:response.feedback}}>
            </div>
          </div>
        );
      }
    }
  }

  render() {
    return (
        <div>
          <div className="c-question-prompt">
            <div dangerouslySetInnerHTML={
              {__html: this.props.question.material}}>
            </div>
          </div>
          <div className="c-answers">
            <UniversalInput
              settings={this.props.settings}
              item={this.props.question}
              isResult={false}
              selectAnswer={this.props.selectAnswer}
              response={this.props.response}
              questionResult={this.props.questionResult}
              localizedStrings={this.props.localizedStrings}/>
          </div>
          {this.getFeedback()}
        </div>
    );
  }
}
<commit_msg>call videoJS in component did mount<commit_after>"use strict";

import React  from "react";

import * as AssessmentActions  from "../../actions/assessment";
import UniversalInput          from "./universal_input";

export default class Item extends React.Component{

  static propTypes = {
    // Assessment configuration settings. these should never be modified.
    settings          : React.PropTypes.object,

    // Item to be displayed
    question          : React.PropTypes.object.isRequired,

    // Array of selected answer IDs
    response          : React.PropTypes.array.isRequired,

    // The position of the item in the array of items
    currentItemIndex  : React.PropTypes.number.isRequired,

    // The total number of items in the array of items
    questionCount     : React.PropTypes.number.isRequired,

    // Graded user response object containing keys
    // correct:true/false, feedback:"Answer feedback"
    questionResult   : React.PropTypes.object.isRequired,

    selectAnswer      : React.PropTypes.func.isRequired,

    // User facing strings of the language specified by the 'locale' setting
    localizedStrings: React.PropTypes.object.isRequired
  };

  componentDidMount(){
    // Look for videos that should be using videojs.
    var videoJSElements = document.querySelectorAll('video.video-js');
    for (var i = 0; i < videoJSElements.length; i++){
      if(_.isFunction(videojs)){videojs(videoJSElements[i]);}
    }
  }

  getFeedback(){
    var response = this.props.questionResult;

    if(response){

      if(response.correct === true){
        return (
          <div className="c-question-feedback  c-feedback--correct">
            <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
              <path d="M24 4C12.95 4 4 12.95 4 24c0 11.04 8.95 20 20 20 11.04 0 20-8.96 20-20 0-11.05-8.96-20-20-20zm-4 30L10 24l2.83-2.83L20 28.34l15.17-15.17L38 16 20 34z"/>
            </svg>
            <div
              dangerouslySetInnerHTML={{__html:response.feedback}}>
            </div>
          </div>
        );
      } else if(response.correct === false) {
        return (
          <div className="c-question-feedback  c-feedback--incorrect">
            <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
              <path d="M24 4c-11.05 0-20 8.95-20 20s8.95 20 20 20 20-8.95 20-20-8.95-20-20-20zm10 27.17l-2.83 2.83-7.17-7.17-7.17 7.17-2.83-2.83 7.17-7.17-7.17-7.17 2.83-2.83 7.17 7.17 7.17-7.17 2.83 2.83-7.17 7.17 7.17 7.17z"/>
            </svg>
            <div
              dangerouslySetInnerHTML={{__html:response.feedback}}>
            </div>
          </div>
        );
      }
    }
  }

  render() {
    return (
        <div>
          <div className="c-question-prompt">
            <div dangerouslySetInnerHTML={
              {__html: this.props.question.material}}>
            </div>
          </div>
          <div className="c-answers">
            <UniversalInput
              settings={this.props.settings}
              item={this.props.question}
              isResult={false}
              selectAnswer={this.props.selectAnswer}
              response={this.props.response}
              questionResult={this.props.questionResult}
              localizedStrings={this.props.localizedStrings}/>
          </div>
          {this.getFeedback()}
        </div>
    );
  }
}

{'fraction_non_alphanumeric': 0.12840526476890113, 'fraction_numerical': 0.07514539332721151, 'mean_word_length': 2.0073630924988497, 'pattern_counts': {'":': 0, '<': 50, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, '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': '3004453', 'n_tokens_mistral': 2350, 'n_tokens_neox': 1991, 'n_words': 449}