<commit_before>TempFiles = new Mongo.Collection(null);

Template.upload.onRendered(function(){
    $(document).ready(function(){
        $('ul.tabs').tabs();
    });
});

Template.upload.events({
    "submit .save-spectrum": function(event) {
        event.preventDefault();
        var target = event.target;
        var instance = Template.instance();
        var fileData = TempFiles.findOne({flag: 'single'});

        Spectra.insert({name: target.name.value, x: fileData.x, y: fileData.y});
        FlowRouter.go("home");
    },
    "submit .save-spectra": function(event) {
        event.preventDefault();
        var target = event.target;
        var instance = Template.instance();
        var fileData = TempFiles.find({flag: {$exists: false}}).fetch();

        fileData.forEach(function(file) {
            Spectra.insert({tag: target.tag.value, x: file.x, y: file.y});
        });

        // FlowRouter.go("pca");
    },
    "change .spectra-upload": function() {
        var files = event.target.files;
        var instance = Template.instance();

        for (i=1; i<files.length; i++) {
            getFileData(files[i], function(err, x, y) {
                TempFiles.insert({
                    x: x,
                    y: y
                });
            });
        }
        // files.forEach(function(file) {
        //
        // });
    },
    "change .spectrum-upload": function() {
        var files = event.target.files;
        var instance = Template.instance();

        getFileData(files[0], function(err, x, y) {
            var layout = {
                xaxis: {
                    title: 'Wavenumber (cm / -1)'
                },
                yaxis: {<commit_msg>shifting to pca page on finish upload batch<commit_after>TempFiles = new Mongo.Collection(null);

Template.upload.onRendered(function(){
    $(document).ready(function(){
        $('ul.tabs').tabs();
    });
});

Template.upload.events({
    "submit .save-spectrum": function(event) {
        event.preventDefault();
        var target = event.target;
        var instance = Template.instance();
        var fileData = TempFiles.findOne({flag: 'single'});

        Spectra.insert({name: target.name.value, x: fileData.x, y: fileData.y});
        FlowRouter.go("home");
    },
    "submit .save-spectra": function(event) {
        event.preventDefault();
        var target = event.target;
        var instance = Template.instance();
        var fileData = TempFiles.find({flag: {$exists: false}}).fetch();

        for (i=1; i<fileData.length; i++) {
            Spectra.insert({tag: target.tag.value, x: fileData[i].x, y: fileData[i].y});
        }

        FlowRouter.go("pca");
    },
    "change .spectra-upload": function() {
        var files = event.target.files;
        var instance = Template.instance();

        for (i=1; i<files.length; i++) {
            getFileData(files[i], function(err, x, y) {
                TempFiles.insert({
                    x: x,
                    y: y
                });
            });
        }
    },
    "change .spectrum-upload": function() {
        var files = event.target.files;
        var instance = Template.instance();

        getFileData(files[0], function(err, x, y) {
            var layout = {
                xaxis: {
                    title: 'Wavenumber (cm / -1)'
                },
                yaxis: {
{'fraction_non_alphanumeric': 0.1563700857227313, 'fraction_numerical': 0.002069169376293231, 'mean_word_length': 1.822351959966639, 'pattern_counts': {'":': 8, '<': 6, '<?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': '6778757', 'n_tokens_mistral': 992, 'n_tokens_neox': 963, 'n_words': 199}