<commit_before>/* @flow */

var Dispatcher = Dispatcher || {},
    util = util || {},
    timer = timer || {},
    notifier = notifier;

(function () {
    'usestrict';

    Dispatcher = function (d) {
        this.method = d.method;
        this.maybe_body = util.nothing();
        this.keyword = d.url.split("/").slice(3).join("/");
        this.url = d.url;
        this.isPost = function () { return this.method === 'POST'; };
        this.isGet = function () { return this.method === 'GET'; };

        if (this.isPost()) {
            this.maybe_body = util.maybe(d.requestBody.formData);
            console.dir(this);
        }
    };

    Dispatcher.prototype = {
        go: function () {
            console.log('dispatcher/go');
            switch (this.keyword) {
            case 'conquest/start':
                this.forConquest();
                break;
            case 'conquest/cancel':
                break;
            default:
                //pass
            }
            return this;
        },
        forConquest: function () {
            console.log('dispatcher/conquest');
            this.maybe_body.fmap(function (body) {
                var param = {
                    party_no: body['party_no'][0],
                    field_id: body['field_id'][0],
                    type: 'conquest'
                };
                timer.conquest(param);
            });
        }
    };

}());<commit_msg>Conquest/cancel<commit_after>/* @flow */

var Dispatcher = Dispatcher || {},
    util = util || {},
    timer = timer || {},
    notifier = notifier;

(function () {
    'usestrict';

    Dispatcher = function (d) {
        this.method = d.method;
        this.maybe_body = util.nothing();
        this.keyword = d.url.split("/").slice(3).join("/");
        this.url = d.url;
        this.isPost = function () { return this.method === 'POST'; };
        this.isGet = function () { return this.method === 'GET'; };

        if (this.isPost()) {
            this.maybe_body = util.maybe(d.requestBody.formData);
            console.dir(this);
        }
    };

    Dispatcher.prototype = {
        go: function () {
            console.log('dispatcher/go');
            switch (this.keyword) {
            case 'conquest/start':
                this.forConquestStart();
                break;
            case 'conquest/cancel':
                this.forConquestCancel();
                break;
            default:
                //pass
            }
            return this;
        },
        forConquestStart: function () {
            console.log('dispatcher/conquest/start');
            this.maybe_body.fmap(function (body) {
                var party_no = body['party_no'][0],
                    field_id = body['field_id'][0],
                    param = {
                    party_no: party_no,
                    field_id: field_id,
                    type: 'conquest'
                    };

                timer.conquest(param);
            });
        },
        forConquestCancel: function () {
            console.log('dispatcher/conquest/cancel');
            this.maybe_body.fmap(function (body) {
                var party_no = body['party_no'][0];
                timer.cancel(function(o) {
                    return o.party_no === party_no;
                });
            });
        }
    };

}());
{'fraction_non_alphanumeric': 0.1439619274241523, 'fraction_numerical': 0.002082093991671624, 'mean_word_length': 1.3419220055710306, 'pattern_counts': {'":': 0, '<': 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': '5355408', 'n_tokens_mistral': 955, 'n_tokens_neox': 911, 'n_words': 157}