<commit_before>var express = require("express");
var router = express.Router();
var Q = require('q');
var crypto = require('crypto');
var uuid = require('node-uuid');

router.route('/').get(function(req,res){

    console.log("Started looking up location.");
    var db = require("../imp_services/impdb.js").connect();
    Q.fcall(db.beginTransaction())
        .then(db.query("USE " + db.databaseName))
        .then(db.query("CALL GetInventoryLocations();"))
        .then(function(row) {

            // We got data about the user
            if (row[0][0].length == 0) { // No user by that username
                res.end("Invalid Credentials!");
            }
            else {
                var locations = [];
                for (var i = 0; i < row[0][0].length; i++)
                {
                    console.log(row[0][0][i].location);
                    locations.push(row[0][0][i].location);
                }

                var sendLocations = {"locationList" : locations};
                console.log ("Ok now we have this too " + sendLocations.locationList[0]);
                    res.send(JSON.stringify(sendLocations));
                res.end(JSON.stringify(sendLocations));
                }
            })
        .then(db.commit())
        .then(db.endTransaction())<commit_msg>Almost Done splitting from 209<commit_after>var express = require("express");
var router = express.Router();
var Q = require('q');
var crypto = require('crypto');
var uuid = require('node-uuid');

router.route('/').get(function(req,res){

    console.log("Started looking up locations.");
    var db = require("../imp_services/impdb.js").connect();
    Q.fcall(db.beginTransaction())
        .then(db.query("USE " + db.databaseName))
        .then(db.query("CALL GetInventoryLocations();"))
        .then(function(row) {

            // We got data about the user
            if (row[0][0].length == 0) { // No user by that username
                res.end("Invalid Credentials!");
            }
            else {
                var locations = [];
                for (var i = 0; i < row[0][0].length; i++)
                {
                    locations.push(row[0][0][i].location);
                }

                var sendLocations = {"locationList" : locations};
                    res.send(JSON.stringify(sendLocations));
                res.end(JSON.stringify(sendLocations));
                }
            })
        .then(db.commit())
        .then(db.endTransaction())
{'fraction_non_alphanumeric': 0.15838011226944668, 'fraction_numerical': 0.008821170809943865, 'mean_word_length': 1.8481735159817352, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1532892', 'n_tokens_mistral': 711, 'n_tokens_neox': 673, 'n_words': 140}