<commit_before>import React from 'react';
import { StyleSheet, View, Text, Image } from 'react-native';
import { Actions } from 'react-native-router-flux';

import SolveTaskInput from './SolveTaskInput';
import TaskButton from '../shared/TaskButton';

const styles = StyleSheet.create({
  container: {
    flexDirection: 'column',
    justifyContent: 'flex-start',
    alignItems: 'stretch',
    paddingHorizontal: 14,
  },
  containerMissionComplete: {
    flex: 1,
    justifyContent: 'center',
    padding: 20,
    backgroundColor: 'rgba(0,0,0,0.5)',
  },
  containerMission: {
    flexDirection: 'column',
    justifyContent: 'flex-start',
    alignItems: 'flex-start',
  },
  containerMissionDescription: {
    flexDirection: 'row',
    justifyContent: 'flex-start',
    alignItems: 'center',
  },
  textTitle: {
    textAlign: 'center',
    fontSize: 18,
    marginTop: 25,
  },
  textMission: {
    alignSelf: 'center',
    marginTop: 5,
    width: 200,
  },
  containerButton: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
  },
  innerContainer: {
    borderRadius: 10,
    alignItems: 'flex-start',
  },
  innerContainerMissionCompleted: {
    flexDirection: 'row',
  },
  modalButton: {
    marginTop: 10,
  },
  icon: {
    marginTop: 7,
    marginRight: 7,
    height: 46,
    width: 46,
  },
});

const SolveTaskModal = React.createClass({
  propTypes: {
    task: React.PropTypes.any.isRequired,
  },

  getInitialState() {
    return {
      userKoins: 0,
      txtUnableToSolve: 'Unable to solve',
      unableToSolve: false,
      btnCompleteMission: '',
      modalVisible: false,
    };
  },

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.textTitle}>{this.props.task.title}</Text>
        <View style={styles.containerMission}>
          <View style={styles.containerMissionDescription}>
            <Image
              style={styles.icon}
              source={require('../../assets/img/koin_no_value.png')}
            />
            <Text style ={styles.textMission}>Get the {this.props.task.fixKoinCount} Koins!</Text>
          </View>
          <View style={styles.containerMissionDescription}>
            <Image
              style={styles.icon}
              source={require('../../assets/img/poi_name_mission.png')}
            />
          <Text style={styles.textMission}>{this.props.task.question}</Text>
          </View>
        </View>
        <SolveTaskInput
          viewType={this.props.task.viewType}
          missionType={this.props.task.type}
          unableToSolve={this.state.unableToSolve}
        />
        <View style={styles.containerButton}>
          <TaskButton style={{ paddingTop: 20 }} onPress={Actions.pop}>
            Cancel
          </TaskButton>
          <TaskButton style={{ paddingTop: 20 }} onPress={Actions.pop}>
            Complete Mission
          </TaskButton>
        </View>
      </View>
    );
  },
});

module.exports = SolveTaskModal;<commit_msg>solve mission<commit_after>import React from 'react';
import { StyleSheet, View, Text, Image } from 'react-native';
import { Actions } from 'react-native-router-flux';

import SolveTaskInput from './SolveTaskInput';
import TaskButton from '../shared/TaskButton';

import MissionActions from '../../actions/MissionActions';

import Mission from '../../dto/Mission';
import Validation from '../../dto/Mission';

const styles = StyleSheet.create({
  container: {
    flexDirection: 'column',
    justifyContent: 'flex-start',
    alignItems: 'stretch',
    paddingHorizontal: 14,
  },
  containerMissionComplete: {
    flex: 1,
    justifyContent: 'center',
    padding: 20,
    backgroundColor: 'rgba(0,0,0,0.5)',
  },
  containerMission: {
    flexDirection: 'column',
    justifyContent: 'flex-start',
    alignItems: 'flex-start',
  },
  containerMissionDescription: {
    flexDirection: 'row',
    justifyContent: 'flex-start',
    alignItems: 'center',
  },
  textTitle: {
    textAlign: 'center',
    fontSize: 18,
    marginTop: 25,
  },
  textMission: {
    alignSelf: 'center',
    marginTop: 5,
    width: 200,
  },
  containerButton: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
  },
  innerContainer: {
    borderRadius: 10,
    alignItems: 'flex-start',
  },
  innerContainerMissionCompleted: {
    flexDirection: 'row',
  },
  modalButton: {
    marginTop: 10,
  },
  icon: {
    marginTop: 7,
    marginRight: 7,
    height: 46,
    width: 46,
  },
});

const SolveTaskModal = React.createClass({
  propTypes: {
    task: React.PropTypes.any.isRequired,
  },

  getInitialState() {
    return {
      userKoins: 0,
      txtUnableToSolve: 'Unable to solve',
      unableToSolve: false,
      btnCompleteMission: '',
      modalVisible: false,
    };
  },

  solveMission() {
    const input = this.refs.input.state;
    MissionActions.solveMission(this.props.task, input.answerValue, input.unableToSolve);
    Actions.pop();
  },

  solveValidation() {

  },

  solveTask() {
    if (this.props.task instanceof Mission) {
      this.solveMission();
    } else if (this.props.task instanceof Validation) {
      this.solveValidation();
    }
  },

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.textTitle}>{this.props.task.title}</Text>
        <View style={styles.containerMission}>
          <View style={styles.containerMissionDescription}>
            <Image
              style={styles.icon}
              source={require('../../assets/img/koin_no_value.png')}
            />
            <Text style ={styles.textMission}>Get the {this.props.task.fixKoinCount} Koins!</Text>
          </View>
          <View style={styles.containerMissionDescription}>
            <Image
              style={styles.icon}
              source={require('../../assets/img/poi_name_mission.png')}
            />
          <Text style={styles.textMission}>{this.props.task.question}</Text>
          </View>
        </View>
        <SolveTaskInput
          ref="input"
          viewType={this.props.task.viewType}
          missionType={this.props.task.type}
          unableToSolve={this.state.unableToSolve}
        />
        <View style={styles.containerButton}>
          <TaskButton style={{ paddingTop: 20 }} onPress={Actions.pop}>
            Cancel
          </TaskButton>
          <TaskButton style={{ paddingTop: 20 }} onPress={this.solveTask}>
            Complete Mission
          </TaskButton>
        </View>
      </View>
    );
  },
});

module.exports = SolveTaskModal;
{'fraction_non_alphanumeric': 0.14326864766525166, 'fraction_numerical': 0.010006064281382655, 'mean_word_length': 2.5146510388918486, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '1676374', 'n_tokens_mistral': 2077, 'n_tokens_neox': 2005, 'n_words': 378}