Skip to content

Commit 33bdb11

Browse files
Update CombinationalAnalysis.vue
1 parent 1ea73f2 commit 33bdb11

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

v0/src/components/DialogBox/CombinationalAnalysis.vue

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,21 +296,33 @@ function createBooleanPrompt(inputList, outputList, scope = globalScope) {
296296
}
297297
298298
function generateBooleanTableData(outputListNames) {
299-
var data = {}
300-
for (var i = 0; i < outputListNames.length; i++) {
301-
data[outputListNames[i]] = {
302-
x: [],
303-
1: [],
304-
0: [],
305-
}
306-
var rows = $(`.${outputListNames[i]}`)
307-
for (let j = 0; j < rows.length; j++) {
308-
data[outputListNames[i]][rows[j].innerHTML].push(rows[j].id)
309-
}
299+
let data = {};
300+
301+
for (let i = 0; i < outputListNames.length; i++) {
302+
let outputName = outputListNames[i];
303+
data[outputName] = { x: [], 1: [], 0: [] };
304+
305+
let tableDiv = document.querySelector("body > div.v-overlay-container > div > div.v-overlay__content > div > div.v-card-text");
306+
let table = tableDiv?.querySelector(".content-table");
307+
let rows = table?.querySelectorAll("tbody tr") || [];
308+
309+
[...rows].forEach((row, index) => {
310+
if (index === 0) return;
311+
let columns = [...row.querySelectorAll("th")];
312+
let lastColumnValue = columns.pop()?.innerText.trim();
313+
314+
((lastColumnValue === '0') && data[outputName]['0'].push(String(index - 1))) ||
315+
((lastColumnValue === '1') && data[outputName]['1'].push(String(index - 1))) ||
316+
data[outputName]['x'].push(String(index - 1));
317+
});
310318
}
311-
return data
319+
320+
return data;
312321
}
313322
323+
324+
325+
314326
function drawCombinationalAnalysis(
315327
combinationalData,
316328
inputList,

0 commit comments

Comments
 (0)