<commit_before>Template.searchresults.helpers({
    statusIs: function (status) {
        return this.status === status;
    },
    Settings: function () {
        return Settings;
    }
});

Template.searchresults.events({
    "click .add-request-movie": function (event) {
        $(event.target).html('<i class="fa fa-spinner fa-spin fa-lg"></i>').removeClass('btn-primary');
        var title = $(event.target).parent().data( "title" );
        var year = $(event.target).parent().data( "year" );
        var id = $(event.target).parent().data( "id" );
        var puser = Session.get("plexuser");
        if (Session.get('searchType') === 'movie') {
            var imdb;
            var url = "https://api.themoviedb.org/3/movie/" + id + "?api_key=<KEY>";

            //Check whether user has hit their weekly limit
            var date = new Date(+new Date - 6.048e8);
        if(Movies.find({user:puser, createdAt: {"$gte": date} }).fetch().length > Settings.findOne({_id:'weeklylimit'}).api) {
            alert("You have already submitted your weekly limit of requests!");
            $(event.target).html('Add').addClass('btn-primary');
        } else {
          (function () {
                $.getJSON(url)
                    .done(function (data) {
                        imdb = data['imdb_id'];
                        id = data['id'];
                        if (Movies.findOne({imdb: imdb}) === undefined) {
                            Meteor.call('searchCP', id, imdb, title, year, puser, function (err, data) {
                                if (err) {
                                    console.log(err)
                                    $(event.target).parent().html('Something went wrong, please let the admin know!');
                                } else if ((data === "active") || (data ==="added")) {
                                    $(event.target).html('Movie added! <i class="fa fa-check-circle"></i>').addClass('btn-success').addClass('disabled');
                                    Meteor.call('pushService', title, year, puser, "Movie");
                                } else if (data === "downloaded") {
                                    $(event.target).html('<i class="icon-download-alt"></i> Already in Library').addClass('btn-warning').addClass('disabled');
                                } else if (data === "error") {
                                    $(event.target).html('<i class="fa fa-exclamation-triangle"></i> Error').addClass('btn-danger');<commit_msg>Added unlimited option by setting variable to 0<commit_after>Template.searchresults.helpers({
    statusIs: function (status) {
        return this.status === status;
    },
    Settings: function () {
        return Settings;
    }
});

Template.searchresults.events({
    "click .add-request-movie": function (event) {
        $(event.target).html('<i class="fa fa-spinner fa-spin fa-lg"></i>').removeClass('btn-primary');
        var title = $(event.target).parent().data( "title" );
        var year = $(event.target).parent().data( "year" );
        var id = $(event.target).parent().data( "id" );
        var puser = Session.get("plexuser");
        if (Session.get('searchType') === 'movie') {
            var imdb;
            var url = "https://api.themoviedb.org/3/movie/" + id + "?api_key=<KEY>";

            //Check whether user has hit their weekly limit
            var date = new Date(+new Date - 6.048e8);
        if (!(Settings.findOne({_id:'weeklylimit'}).api == 0) && (Movies.find({user:puser, createdAt: {"$gte": date} }).fetch().length >= Settings.findOne({_id:'weeklylimit'}).api)) {
            alert("You have already submitted your weekly limit of requests!");
            $(event.target).html('Add').addClass('btn-primary');
        } else {
          (function () {
                $.getJSON(url)
                    .done(function (data) {
                        imdb = data['imdb_id'];
                        id = data['id'];
                        if (Movies.findOne({imdb: imdb}) === undefined) {
                            Meteor.call('searchCP', id, imdb, title, year, puser, function (err, data) {
                                if (err) {
                                    console.log(err)
                                    $(event.target).parent().html('Something went wrong, please let the admin know!');
                                } else if ((data === "active") || (data ==="added")) {
                                    $(event.target).html('Movie added! <i class="fa fa-check-circle"></i>').addClass('btn-success').addClass('disabled');
                                    Meteor.call('pushService', title, year, puser, "Movie");
                                } else if (data === "downloaded") {
                                    $(event.target).html('<i class="icon-download-alt"></i> Already in Library').addClass('btn-warning').addClass('disabled');
                                } else if (data === "error") {
                                    $(event.target).html('<i class="fa fa-exclamation-triangle"></i> Error').addClass('btn-danger');
{'fraction_non_alphanumeric': 0.1695609756097561, 'fraction_numerical': 0.0027317073170731706, 'mean_word_length': 1.7367859049652963, 'pattern_counts': {'":': 4, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5879224', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1326, 'n_words': 293}