<commit_before>App.Questions = React.createClass({
    mixins: [ReactMeteorData],
    PropTypes: {},

    getMeteorData() {
        var data = {},
            handle = Meteor.subscribe('questions');

        if (handle.ready()) {
            data.questions = Questions.find({}, {sort: {order: 1}}).fetch();
        }

        return data;
    },

    calculateChoices: function (event) {
        event.preventDefault();

        var sum = 0;
        $('.radio.input:checked').each(function() {
            sum += Number($(this).val());
        });

        if (sum >= 10) {
            console.log('route to referrals');
        } else {
            console.log('route to positive');
        }
    },

    renderQuestion() {
        return this.data.questions.map(function (question) {
            return (
                <section className="question" key={question._id}>
                    <h2 className="title">{question.order}. {question.question}</h2>

                    <div className="radio input group">
                        <App.FormInput type="radio" label={question.choices[0].choice} name={question.name} value={question.choices[0].value} />
                        <App.FormInput type="radio" label={question.choices[1].choice} name={question.name} value={question.choices[1].value} />
                        <App.FormInput type="radio" label={question.choices[2].choice} name={question.name} value={question.choices[2].value} />
                        <App.FormInput type="radio" label={question.choices[3].choice} name={question.name} value={question.choices[3].value} />
                    </div>
                </section>
            )<commit_msg>refactor calculateChoices function<commit_after>App.Questions = React.createClass({
    mixins: [ReactMeteorData],
    PropTypes: {},

    getMeteorData() {
        var data = {},
            handle = Meteor.subscribe('questions');

        if (handle.ready()) {
            data.questions = Questions.find({}, {sort: {order: 1}}).fetch();
        }

        return data;
    },

    calculateChoices: function (event) {
        event.preventDefault();

        var sum = 0,
            threshold = 10;

        $('.radio.input:checked').each(function() {
            sum += Number($(this).val());
        });

        (sum >= threshold) ? console.log('1') : console.log('2');
    },

    renderQuestion() {
        return this.data.questions.map(function (question) {
            return (
                <section className="question" key={question._id}>
                    <h2 className="title">{question.order}. {question.question}</h2>

                    <div className="radio input group">
                        <App.FormInput type="radio" label={question.choices[0].choice} name={question.name} value={question.choices[0].value} />
                        <App.FormInput type="radio" label={question.choices[1].choice} name={question.name} value={question.choices[1].value} />
                        <App.FormInput type="radio" label={question.choices[2].choice} name={question.name} value={question.choices[2].value} />
                        <App.FormInput type="radio" label={question.choices[3].choice} name={question.name} value={question.choices[3].value} />
                    </div>
                </section>
            )
{'fraction_non_alphanumeric': 0.15878276589334137, 'fraction_numerical': 0.009038867128653209, 'mean_word_length': 2.0430797433547205, 'pattern_counts': {'":': 0, '<': 23, '<?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': '4617382', 'n_tokens_mistral': 934, 'n_tokens_neox': 879, 'n_words': 150}