JSFiddle - React, Tailwind, and code Playground

by Gretchen Ward

JavaScript

function createTableRows(geographyKeys){
            var tableData=[];
            var dataTypeKeys = ParameterService.selectedDataTypes();
            var orderBy = ParameterService.selectedTableRowOrder();

            if( orderBy == 'A' /* activity order */) {
                /* ConfigService.getDataTypes() returns all the data types as an object with the id property as the key
                 * ParameterService.selectedDataTypes() returns the currently selected data types in an array
                 * Change this loop to loop over the selected data types as opposed to all data types
                 */

                angular.forEach(ParameterService.selectedDataTypes(), function (dataVal, index) { //for each data type in this entity
                    var dataKey = dataVal.id;
                    var dtHasData = false;
                    var baData = [];
                    var baInfo = {
                        title: dataVal.id,
                        code: dataVal.id,
                        api: 0
                    };

                    var fetchKey = key;

                    if (dataKey.substring(0, 4) == 'REG-') {
                        fetchKey = fetchKey.substring(4);
                        baInfo['title'] = ConfigService.getERs()[fetchKey].name + ' (region)';

                    }

                    baData.push(baInfo);


                    for (var x = 0; x < geographyKeys.length; x++) {//for each item
                        var key = geographyKeys[x];
                        var row = {
                            title: key,
                            code:key,
                            api:1,
                            datatype: dataKey
                        };

                        var currentDate = startDate.clone();
                        while (currentDate <= endDate) {
                            var theValue = DataService.getData(currentDate.format("YYYYMMDDTHH"), fetchKey, dataKey);

                           ...