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;

                    tableData.push({
                        title: dataVal.id,
                        code: dataVal.id,
                        api: 0
                    });

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

                        tableData['h' + currentDate.valueOf()] = theValue;

                        currentDate.add(1, 'hour');
                        if (typeof theValue !== 'undefined') {
                            dtHasData = true;
                            baHasData = true;
                        }
                    }

                    if (baHasData)
                        angular.forEach(baData, function (value, index) {
                            tableData.push(value);
                        });


                    for (var x = 0; x < geographyKeys.length; x++) {//for each item
                        var key = geographyKeys[x];
                        tableData.push({
                            title: key,
              ...