<commit_before>(() => {
    angular
        .module('dpShared')
        .factory('nearestDetail', nearestDetailFactory);

    nearestDetailFactory.$inject = ['$q', 'api', 'store', 'ACTIONS', 'mapConfig'];

    function nearestDetailFactory ($q, api, store, ACTIONS, mapConfig) {
        let detailLocation = [],
            numberOfPoints = 0,
            dispatcher;

        return {
            getLocation,
            search
        };

        // public methods
        function getLocation () {
            return detailLocation;
        }

        function search (location, overlays, zoom, callback) {
            const pointRequests = [],
                shapeRequests = [];

            detailLocation = location;
            dispatcher = callback;
            numberOfPoints = 0;

            overlays.reverse().forEach((overlay) => {
                const searchParams = {
                    item: overlay.detailItem,
                    lat: location[0],
                    lon: location[1]
                };

                searchParams.radius = overlay.detailIsShape ? 0 : Math.round(
                    Math.pow(2, mapConfig.BASE_LAYER_OPTIONS.maxZoom - zoom) / 2);

                const request = api.getByUri(overlay.detailUrl, searchParams).then(
                    data => data,
                    () => { return { features: [] }; });    // empty features on failure of api call

                if (overlay.detailIsShape) {
                    shapeRequests.push(request);
                } else {
                    pointRequests.push(request);
                }
            });

            numberOfPoints = pointRequests.length;
            return $q.all(pointRequests.concat(shapeRequests)).then(checkForDetailResults);
        }

        // non public methods
        function checkForDetailResults (response) {
            const shapesArray = response.splice(numberOfPoints),
                foundShapes = flattenResponse(shapesArray),
                foundPoints = flattenResponse(response).sort((a, b) => a.distance - b.distance),
                found = foundPoints[0] || foundShapes[0];
<commit_msg>fixed issue with incorrect hr calls tg-4928<commit_after>(() => {
    angular
        .module('dpShared')
        .factory('nearestDetail', nearestDetailFactory);

    nearestDetailFactory.$inject = ['$q', 'api', 'store', 'ACTIONS', 'mapConfig'];

    function nearestDetailFactory ($q, api, store, ACTIONS, mapConfig) {
        let detailLocation = [],
            numberOfPoints = 0,
            dispatcher;

        return {
            getLocation,
            search
        };

        // public methods
        function getLocation () {
            return detailLocation;
        }

        function search (location, overlays, zoom, callback) {
            const pointRequests = [],
                shapeRequests = [],
                user = store.getState().user;

            detailLocation = location;
            dispatcher = callback;
            numberOfPoints = 0;

            overlays.reverse().forEach((overlay) => {
                if (overlay.authScope && !user.scopes.includes(overlay.authScope)) {
                    return;
                }

                const searchParams = {
                    item: overlay.detailItem,
                    lat: location[0],
                    lon: location[1]
                };

                searchParams.radius = overlay.detailIsShape ? 0 : Math.round(
                    Math.pow(2, mapConfig.BASE_LAYER_OPTIONS.maxZoom - zoom) / 2);

                const request = api.getByUri(overlay.detailUrl, searchParams).then(
                    data => data,
                    () => { return { features: [] }; });    // empty features on failure of api call

                if (overlay.detailIsShape) {
                    shapeRequests.push(request);
                } else {
                    pointRequests.push(request);
                }
            });

            numberOfPoints = pointRequests.length;
            return $q.all(pointRequests.concat(shapeRequests)).then(checkForDetailResults);
        }

        // non public methods
        function checkForDetailResults (response) {
            const shapesArray = response.splice(numberOfPoints),
                foundShapes = flattenResponse(shapesArray),
                foundPoints = flattenResponse(response).sort((a, b) => a.distance - b.distance),
                found = foundPoints[0] || foundShapes[0];

{'fraction_non_alphanumeric': 0.1053921568627451, 'fraction_numerical': 0.004901960784313725, 'mean_word_length': 1.5724928366762179, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '4626665', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1059, 'n_words': 226}