<commit_before>// Utilities used by various routes
// A utility to render the error page, and log it...
exports.render_error_page = function (req, res, bug_subject, bug_body_comment) {
    var date = Date();
    //var session_data = JSON.stringify(req.session);
    var bug_report = JSON.stringify({
        date: date,
        session: req.session,
        note: bug_body_comment
    });
    console.log("Error Page Rendered, subject " + bug_subject + ". Report: " + bug_report);
    res.render('error_page', {
        bugreport: bug_subject,
        bugreport_body: bug_report,
        title: 'Error'
    });
}
// A utility that checks to see if we have a valid user name; if we do, return true and
// make sure req.session.user has the user name.  If not, return false
exports.checkHasUser = function(req, res) {
    if (req.session.user) {
        return true;
    }
    // otherwise it might be in req.session.passport.user.emails[0].value
    if (req.session.passport && req.session.passport.user && req.session.passport.user.emails && req.session.passport.user.emails.length > 0 && req.session.passport.user.emails[0].value) {
        req.session.user = req.session.passport.user.emails[0].value
        return true;
    }
    return false;
}
// Render the login page
exports.renderLoginPage = function(req, res) {
    res.render('main', {
        title: 'Welcome to GEE'
    });
}
// A utility to make a slice name from a number
exports.makeSliceName = function(aNumber) {
    return "slice" + aNumber;
}
// A utility function called from logged_in, get_slicelet, renew_slicelet, download_slicelet...
// Render the page with the user's slice information
// This is only called when req.session.slice_data.slice != null
// all of the slice information is in slice_dictionary, and is of the form
// {"slice": <slicename>", "slicelet_file": <filename>, "user": "<username>, "has_slicelet": true}
exports.render_slice_dashboard = function (req, res, slice_dictionary) {
    var colors = {Running: 'Green', Processing: 'Orange', 'Error':'Red'};

    var page_dictionary = {
        slice: exports.makeSliceName(slice_dictionary.sliceNum),
        user: req.session.user,
        admin: req.session.admin,
        date: slice_dictionary.expires,<commit_msg>changed Pensing Approval color to Purple<commit_after>// Utilities used by various routes
// A utility to render the error page, and log it...
exports.render_error_page = function (req, res, bug_subject, bug_body_comment) {
    var date = Date();
    //var session_data = JSON.stringify(req.session);
    var bug_report = JSON.stringify({
        date: date,
        session: req.session,
        note: bug_body_comment
    });
    console.log("Error Page Rendered, subject " + bug_subject + ". Report: " + bug_report);
    res.render('error_page', {
        bugreport: bug_subject,
        bugreport_body: bug_report,
        title: 'Error'
    });
}
// A utility that checks to see if we have a valid user name; if we do, return true and
// make sure req.session.user has the user name.  If not, return false
exports.checkHasUser = function(req, res) {
    if (req.session.user) {
        return true;
    }
    // otherwise it might be in req.session.passport.user.emails[0].value
    if (req.session.passport && req.session.passport.user && req.session.passport.user.emails && req.session.passport.user.emails.length > 0 && req.session.passport.user.emails[0].value) {
        req.session.user = req.session.passport.user.emails[0].value
        return true;
    }
    return false;
}
// Render the login page
exports.renderLoginPage = function(req, res) {
    res.render('main', {
        title: 'Welcome to GEE'
    });
}
// A utility to make a slice name from a number
exports.makeSliceName = function(aNumber) {
    return "slice" + aNumber;
}
// A utility function called from logged_in, get_slicelet, renew_slicelet, download_slicelet...
// Render the page with the user's slice information
// This is only called when req.session.slice_data.slice != null
// all of the slice information is in slice_dictionary, and is of the form
// {"slice": <slicename>", "slicelet_file": <filename>, "user": "<username>, "has_slicelet": true}
exports.render_slice_dashboard = function (req, res, slice_dictionary) {
    var colors = {Running: 'Green', Processing: 'Orange', 'Pending Approval': 'Purple', 'Error':'Red'};

    var page_dictionary = {
        slice: exports.makeSliceName(slice_dictionary.sliceNum),
        user: req.session.user,
        admin: req.session.admin,
        date: slice_dictionary.expires,
{'fraction_non_alphanumeric': 0.1228415300546448, 'fraction_numerical': 0.0017486338797814208, 'mean_word_length': 3.272642390289449, 'pattern_counts': {'":': 8, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1342248', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1369, 'n_words': 409}