<commit_before>const async = require('async');
const sql = require('sql-bricks');
let updateData; //to be defined
let app; //to be defined
let updateObjects; //to be defined

module.exports = function (appObj) {
	app = appObj;
    updateData = require('./update-data.js')(app);
    //include all the objects above in an array for future use
    updateObjects = [updateData.hmiLevelUpdate, updateData.countriesUpdate, updateData.categoriesUpdate, 
        updateData.rpcNamesUpdate, updateData.vehicleDataUpdate];
	return {
        getAppRequests: getAppRequests,
        //getPendingApps: getPendingApps,
		//denyApp: denyApp,
		evaluateAppRequest: evaluateAppRequest,
        forceUpdate: forceUpdate
	};
}
//TODO: ignore status of incoming apps, set to STAGING
//when they get approved, they go to production
//the difference of the different endpoints comes in here. in staging, approved and pending are given permission
//in production only approved apps are given permission

function getAppRequests (callback) {
    //use the data collectors to get application request data
    //SHAID should be the first module to run for this
    collectData('getAppRequests', function (appRequests) {
        callback(appRequests);
    }); 
}

function evaluateAppRequest (appObj, callback) {
    const tasks = updateObjects.map(function (updateObj) {
        return function (next) {
            //update check
            performUpdateCycle(updateObj.getDataFunc(appObj), updateObj.tableName, updateObj.databasePropName, updateObj.moduleFuncName, 
                updateObj.errorCallback, updateObj.transformDataFunc, next);
        }
    });

    async.parallel(tasks, function (err) {
        //database is updated. 
        insertAppRequest(appObj, callback);
    });
}

function forceUpdate (callback) {
    //update each set of data in the database for the objects in updateObjects
    const tasks = updateObjects.map(function (updateObj) {<commit_msg>Hotfix where the callback function of collectData is not set up correctly<commit_after>const async = require('async');
const sql = require('sql-bricks');
let updateData; //to be defined
let app; //to be defined
let updateObjects; //to be defined

module.exports = function (appObj) {
	app = appObj;
    updateData = require('./update-data.js')(app);
    //include all the objects above in an array for future use
    updateObjects = [updateData.hmiLevelUpdate, updateData.countriesUpdate, updateData.categoriesUpdate, 
        updateData.rpcNamesUpdate, updateData.vehicleDataUpdate];
	return {
        getAppRequests: getAppRequests,
        //getPendingApps: getPendingApps,
		//denyApp: denyApp,
		evaluateAppRequest: evaluateAppRequest,
        forceUpdate: forceUpdate
	};
}
//TODO: ignore status of incoming apps, set to STAGING
//when they get approved, they go to production
//the difference of the different endpoints comes in here. in staging, approved and pending are given permission
//in production only approved apps are given permission

function getAppRequests (callback) {
    //use the data collectors to get application request data
    //SHAID should be the first module to run for this
    collectData('getAppRequests', function (err, appRequests) {
        callback(appRequests);
    }); 
}

function evaluateAppRequest (appObj, callback) {
    const tasks = updateObjects.map(function (updateObj) {
        return function (next) {
            //update check
            performUpdateCycle(updateObj.getDataFunc(appObj), updateObj.tableName, updateObj.databasePropName, updateObj.moduleFuncName, 
                updateObj.errorCallback, updateObj.transformDataFunc, next);
        }
    });

    async.parallel(tasks, function (err) {
        //database is updated. 
        insertAppRequest(appObj, callback);
    });
}

function forceUpdate (callback) {
    //update each set of data in the database for the objects in updateObjects
    const tasks = updateObjects.map(function (updateObj) {
{'fraction_non_alphanumeric': 0.08793146888384984, 'fraction_numerical': 0.0, 'mean_word_length': 3.557979334098737, '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': '7462442', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1041, 'n_words': 356}