<commit_before>var React = require('react-native');
var FeedbackView = require('./display_feedback/feedbackView');
var api = require('./../../utils/api');
var NavBar = require('./../shared/navbar');
var Button = require('./../shared/button');

var {
  View,
  Text,
  StyleSheet,
  Navigator,
  TouchableOpacity,
  TouchableHighlight,
  Modal,
  Alert,
  TextInput,
  Dimensions,
} = React;

class RequestFeedbackView extends React.Component {
  constructor(props) {
    super(props);
    var {height, width} = Dimensions.get('window');
    this.state = {
      lessonId: this.props.route.lessonId,
      classId: this.props.route.classId,
      socket: this.props.route.socket,
      modal: false,
      modalQuestion: false,
      height: height,
      width: width,
      feedbackOptions: [
        {
          id: 1,
          name: 'Thumbs Check',
          /*options:{for preset answers?}*/
        },
        {
          id: 2,
          name: 'Multiple Choice'
        }
      ],
      numberOfStudentHands: 0,
      raisedHandList: [],
      count: 0,
      questionLists:['I have a question', 'Idontknow']
    };
    //populate feedbackOptions with anything custom from lesson
    this.state.socket.on('studentRaisedHand', function(data){
      var numberOfStudentHands = this.state.numberOfStudentHands + 1;
      var raisedHandList = this.state.raisedHandList.slice();
      raisedHandList.push({student: data.user.firstName + ' ' + data.user.lastName , active: true});
      this.setState({
        numberOfStudentHands: numberOfStudentHands,
        raisedHandList: raisedHandList
      });
    }.bind(this))

    this.state.socket.on('studentQuestions', function(data){
      console.log('data >>>>>>>>>>>>>>>', data)
      var questionLists = this.state.questionLists.slice();
      questionLists.push(data.question);
      console.log('questionLists >>>>>>', questionLists);
      this.setState({
        questionLists: questionLists,
      })
    }.bind(this))
  }

  answeredQuestion() {
    var questionLists = this.state.questionLists.slice();
    questionLists.shift();
    this.setState({
      questionLists: questionLists,
    })
  }

  clickQuestion() {
    this.setState({
      modalQuestion: !this.state.modalQuestion,
    })
  }

  clickRaisedHand() {
    var count = this.state.count + 1;
    this.setState({
      modal: !this.state.modal,
      count: count,
    })
  }

  dismissClass() {
    // emit socket dismissClass<commit_msg>clean up hard code state with delete console.log<commit_after>var React = require('react-native');
var FeedbackView = require('./display_feedback/feedbackView');
var api = require('./../../utils/api');
var NavBar = require('./../shared/navbar');
var Button = require('./../shared/button');

var {
  View,
  Text,
  StyleSheet,
  Navigator,
  TouchableOpacity,
  TouchableHighlight,
  Modal,
  Alert,
  TextInput,
  Dimensions,
} = React;

class RequestFeedbackView extends React.Component {
  constructor(props) {
    super(props);
    var {height, width} = Dimensions.get('window');
    this.state = {
      lessonId: this.props.route.lessonId,
      classId: this.props.route.classId,
      socket: this.props.route.socket,
      modal: false,
      modalQuestion: false,
      height: height,
      width: width,
      feedbackOptions: [
        {
          id: 1,
          name: 'Thumbs Check',
          /*options:{for preset answers?}*/
        },
        {
          id: 2,
          name: 'Multiple Choice'
        }
      ],
      numberOfStudentHands: 0,
      raisedHandList: [],
      count: 0,
      questionLists:[]
    };
    //populate feedbackOptions with anything custom from lesson
    this.state.socket.on('studentRaisedHand', function(data){
      var numberOfStudentHands = this.state.numberOfStudentHands + 1;
      var raisedHandList = this.state.raisedHandList.slice();
      raisedHandList.push({student: data.user.firstName + ' ' + data.user.lastName , active: true});
      this.setState({
        numberOfStudentHands: numberOfStudentHands,
        raisedHandList: raisedHandList
      });
    }.bind(this))

    this.state.socket.on('studentQuestions', function(data){
      var questionLists = this.state.questionLists.slice();
      questionLists.push(data.question);
      this.setState({
        questionLists: questionLists,
      })
    }.bind(this))
  }

  answeredQuestion() {
    var questionLists = this.state.questionLists.slice();
    questionLists.shift();
    this.setState({
      questionLists: questionLists,
    })
  }

  clickQuestion() {
    this.setState({
      modalQuestion: !this.state.modalQuestion,
    })
  }

  clickRaisedHand() {
    var count = this.state.count + 1;
    this.setState({
      modal: !this.state.modal,
      count: count,
    })
  }

  dismissClass() {
    // emit socket dismissClass
{'fraction_non_alphanumeric': 0.13626009525781735, 'fraction_numerical': 0.0024849865396562435, 'mean_word_length': 2.6507936507936507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, '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': '5321591', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1425, 'n_words': 284}