<commit_before>var ArticleContentExistsAssistant = function () {};

ArticleContentExistsAssistant.prototype.run = function (outerfuture) {
    var args = this.controller.args, filename, future = new Future();

    if (!args.id) {
        outerfuture.result = {success: false, message: "Need id argument!", activityId: args.activityId};
        return outerfuture;
    }

    filename = Utils.getFileName(args.id);

    path.exists(filename, function (exists) {
        if (exists) {
            future.result = true;
        } else {
            outerfuture.result = {success: false, message: "File not found: " + filename, activityId: args.activityId};
        }
    });

    future.then(function readFile() {
        future.getResult(); //consume result.
        fs.readFile(filename, function (err, content) {
            if (err) {
                outerfuture.result = {success: false, message: JSON.stringify(err), activityId: args.activityId};
            } else {
                var obj = JSON.parse(content);
                outerfuture.result = {
                    success: obj.web && (obj.spritz || !args.requireSpritz),
                    id: args.id,
                    activityId: args.activityId
                };
            }
        });
    });
};
<commit_msg>removed unnecessary exists check in article content assistant (was ignored anyway)<commit_after>var ArticleContentExistsAssistant = function () {};

ArticleContentExistsAssistant.prototype.run = function (outerfuture) {
    var args = this.controller.args, filename, future = new Future();

    if (!args.id) {
        outerfuture.result = {success: false, message: "Need id argument!", activityId: args.activityId};
        return outerfuture;
    }

    filename = Utils.getFileName(args.id);

    fs.readFile(filename, function (err, content) {
        if (err) {
            outerfuture.result = {success: false, message: JSON.stringify(err), activityId: args.activityId};
        } else {
            var obj = JSON.parse(content);
            log("id " + args.id + " needs dl: " + (obj.web && (obj.spritz || !args.requireSpritz)));
            outerfuture.result = {
                success: obj.web && (obj.spritz || !args.requireSpritz),
                id: args.id,
                activityId: args.activityId
            };
        }
    });
};

{'fraction_non_alphanumeric': 0.12574850299401197, 'fraction_numerical': 0.0, 'mean_word_length': 2.190995907230559, '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': '7576282', 'n_tokens_mistral': 644, 'n_tokens_neox': 621, 'n_words': 148}