<commit_before>'use strict';

var $ = require('jquery');
var React = require('react');
var ReactA = require('react-addons');
var Imagebox = require('./Imagebox');
var JSONPath = require('JSONPath');
//var ImageGallery = require('react-image-gallery');

require('styles/ProtocolVerifier.less');

var images = [
    {
        original: 'http://lorempixel.com/1000/600/nature/1/',
        thumbnail: 'http://lorempixel.com/250/150/nature/1/'
    },
    {
        original: 'http://lorempixel.com/1000/600/nature/2/',
        thumbnail: 'http://lorempixel.com/250/150/nature/2/'
    },
    {
        original: 'http://lorempixel.com/1000/600/nature/3/',
        thumbnail: 'http://lorempixel.com/250/150/nature/3/'
    }
];

var ProtocolVerifier = React.createClass({

    getInitialState: function() {
        return { options: [], imageUrls: [], verificationUrl: null, ballotResult: null, communityCode: null, wardNo: null };
    },

    fetchBallot: function(ballotUrl) {
        $.ajax({
            url: ballotUrl, dataType: 'json',
            success: function(data) {
                var state = this.state;
                state.options = [];
                data.options.forEach( function(s) {
                    state.options.push(s);
                });
                this.setState(state);
            }.bind(this),
            error: function(xhr, status, err) { console.error(this.props.url, status, err.toString()); }.bind(this)
        });
    },

    fetchImageUrls: function(urlUrls) {

        console.log("Image urls url: " + urlUrls);
        $.ajax({
            type: "GET",
            url: urlUrls,
            success: function (data) {

                var state = this.state;

                this.state.imageUrls = [];
                for (var i in data) {
                    state.imageUrls.push(data[i]);
                }

                this.setState(state);

                if (this.state.imageUrls.length == 0) {
                    this.fetchProtocol();
                }

            }.bind(this)
        });
    },

    reportV: function() {

        $.ajax({
            type: "POST",
            url: this.state.verificationUrl,
            headers: {
                "Authorization":  "Bearer " + this.props.authorization
            },
            data: "\"APPROVAL\"",
            contentType: "application/json",
            success: function (data) {
                this.fetchProtocol();
            }.bind(this),
            error: function (xhr, status, err) {
                console.error(this.state.verificationUrl, status, err.toString());<commit_msg>no automatic skipping of protocols without images attached<commit_after>'use strict';

var $ = require('jquery');
var React = require('react');
var ReactA = require('react-addons');
var Imagebox = require('./Imagebox');
var JSONPath = require('JSONPath');
//var ImageGallery = require('react-image-gallery');

require('styles/ProtocolVerifier.less');

var images = [
    {
        original: 'http://lorempixel.com/1000/600/nature/1/',
        thumbnail: 'http://lorempixel.com/250/150/nature/1/'
    },
    {
        original: 'http://lorempixel.com/1000/600/nature/2/',
        thumbnail: 'http://lorempixel.com/250/150/nature/2/'
    },
    {
        original: 'http://lorempixel.com/1000/600/nature/3/',
        thumbnail: 'http://lorempixel.com/250/150/nature/3/'
    }
];

var ProtocolVerifier = React.createClass({

    getInitialState: function() {
        return { options: [], imageUrls: [], verificationUrl: null, ballotResult: null, communityCode: null, wardNo: null };
    },

    fetchBallot: function(ballotUrl) {
        $.ajax({
            url: ballotUrl, dataType: 'json',
            success: function(data) {
                var state = this.state;
                state.options = [];
                data.options.forEach( function(s) {
                    state.options.push(s);
                });
                this.setState(state);
            }.bind(this),
            error: function(xhr, status, err) { console.error(this.props.url, status, err.toString()); }.bind(this)
        });
    },

    fetchImageUrls: function(urlUrls) {

        console.log("Image urls url: " + urlUrls);
        $.ajax({
            type: "GET",
            url: urlUrls,
            success: function (data) {

                var state = this.state;

                this.state.imageUrls = [];
                for (var i in data) {
                    state.imageUrls.push(data[i]);
                }

                this.setState(state);

                //if (this.state.imageUrls.length == 0) {
                //    this.fetchProtocol();
                //}

            }.bind(this)
        });
    },

    reportV: function() {

        $.ajax({
            type: "POST",
            url: this.state.verificationUrl,
            headers: {
                "Authorization":  "Bearer " + this.props.authorization
            },
            data: "\"APPROVAL\"",
            contentType: "application/json",
            success: function (data) {
                this.fetchProtocol();
            }.bind(this),
            error: function (xhr, status, err) {
                console.error(this.state.verificationUrl, status, err.toString());
{'fraction_non_alphanumeric': 0.14940125451435088, 'fraction_numerical': 0.017487169739593234, 'mean_word_length': 1.715170278637771, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '2482684', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1491, 'n_words': 274}