Skip to content

Commit 8b478f5

Browse files
authored
Update predbat-table-card.js
Fixed issue where iBoost column was breaking the hide_empty_columns configuration
1 parent f912d76 commit 8b478f5

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

predbat-table-card.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class PredbatTableCard extends HTMLElement {
182182
carEmpty = true;
183183

184184
if(columnsToReturn.includes("iboost-column"))
185-
iboostEmpty = true;
185+
iBoostEmpty = true;
186186

187187
dataArray.forEach((item, index) => {
188188
if(item["car-column"] !== undefined && item["car-column"].value.length > 0)
@@ -413,8 +413,11 @@ class PredbatTableCard extends HTMLElement {
413413
if (theItem.value.length > 0 && !theItem.value.includes("☀"))
414414
newCell.style.backgroundColor = "#FFFFFF";
415415

416+
//console.log("PV Data: " + theItem.value);
416417
newContent = theItem.value.replace(/[]/g, '');
418+
//console.log("PV Data 1: " + newContent);
417419
newContent = parseFloat(newContent).toFixed(2);
420+
//console.log("PV Data 2: " + newContent);
418421

419422
let additionalIcon = "";
420423
if(!this.isSmallScreen())
@@ -992,6 +995,21 @@ class PredbatTableCard extends HTMLElement {
992995

993996
let firstRowData = 0;
994997

998+
/*
999+
const str = "1.79 (0.75)";
1000+
1001+
// Step 1: Use a regular expression to find all float numbers
1002+
const floatRegex = /-?\d+(\.\d+)?/g; // This regex matches positive and negative floats
1003+
const matches = str.match(floatRegex); // Get an array of matches
1004+
1005+
// Step 2: Convert the matches to floating-point numbers
1006+
const floats = matches.map(match => parseFloat(match));
1007+
1008+
// Step 3: Loop through each float and do something with it
1009+
floats.forEach(float => {
1010+
console.log(float); // Here you can replace this line with whatever you want to do with each float
1011+
});*/
1012+
9951013
trElements.forEach((trElement, index) => {
9961014
if(firstRowData === 0){
9971015
const numberOfChildren = trElement.children.length;
@@ -1001,9 +1019,7 @@ class PredbatTableCard extends HTMLElement {
10011019
firstRowData = index;
10021020
}
10031021
}
1004-
});
1005-
1006-
//console.log("Index of first row data: " + firstRowData);
1022+
});
10071023

10081024
trElements.forEach((trElement, index) => {
10091025

@@ -1028,7 +1044,15 @@ class PredbatTableCard extends HTMLElement {
10281044

10291045
if(columnHeaderTitle.includes("CO2 KG")) {
10301046
headerClassesArray.splice(checkIndex-1, 0, "co2kg-column");
1031-
}
1047+
}
1048+
/*
1049+
if(columnHeaderTitle.includes("PV KWH (10%)")) {
1050+
headerClassesArray.splice(checkIndex-1, 0, "pv10-column");
1051+
}
1052+
1053+
if(columnHeaderTitle.includes("LOAD KWH (10%)")) {
1054+
headerClassesArray.splice(checkIndex-1, 0, "load10-column");
1055+
} */
10321056

10331057
});
10341058

0 commit comments

Comments
 (0)