-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-conditions.js
More file actions
62 lines (53 loc) · 2.06 KB
/
debug-conditions.js
File metadata and controls
62 lines (53 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Script pour débugger les conditions dans le localStorage
// Exécuter ce script dans la console du navigateur
function debugConditions() {
console.log("=== DEBUG CONDITIONS ===");
// Lister tous les workflows
const workflows = [];
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if (key && key.startsWith('workflow_')) {
try {
const data = JSON.parse(localStorage.getItem(key));
workflows.push({ key, data });
} catch (e) {
console.error('Erreur parsing:', key);
}
}
}
console.log(`Nombre de workflows trouvés: ${workflows.length}`);
// Analyser chaque workflow
workflows.forEach(({ key, data }) => {
console.log(`\n--- Workflow: ${data.metadata?.name || key} ---`);
// Trouver les nodes de condition
const conditionNodes = data.nodes.filter(n => n.type === 'condition');
console.log(`Nodes de condition: ${conditionNodes.length}`);
conditionNodes.forEach(node => {
console.log(`\nCondition: ${node.data.label} (${node.id})`);
console.log('Branches:', node.data.branches);
// Trouver les edges sortants
const outgoingEdges = data.edges.filter(e => e.source === node.id);
console.log('Edges sortants:');
outgoingEdges.forEach(edge => {
console.log(` - Edge ${edge.id}:`);
console.log(` sourceHandle: ${edge.sourceHandle}`);
console.log(` label: ${edge.label}`);
console.log(` target: ${edge.target}`);
console.log(` data:`, edge.data);
});
});
});
// Vérifier currentQuestionnaire
const current = localStorage.getItem('currentQuestionnaire');
if (current) {
console.log('\n=== CURRENT QUESTIONNAIRE ===');
const data = JSON.parse(current);
const conditionNodes = data.nodes.filter(n => n.type === 'condition');
conditionNodes.forEach(node => {
console.log(`Condition: ${node.data.label}`);
console.log('Branches:', JSON.stringify(node.data.branches, null, 2));
});
}
}
// Exécuter la fonction
debugConditions();