-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_payload.js
More file actions
45 lines (38 loc) Β· 2.05 KB
/
debug_payload.js
File metadata and controls
45 lines (38 loc) Β· 2.05 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
import { parseQuizToBatchUpdate } from "./src/utils/quizParser.js";
import fs from "fs";
const quiz = JSON.parse(fs.readFileSync("/tmp/python.json", "utf8"));
const result = parseQuizToBatchUpdate(quiz);
console.log("π Analyzing quiz structure...\n");
// Analizza i primi 5 requests
result.requests.slice(0, 5).forEach((req, index) => {
console.log(`\nβββ Request ${index} βββ`);
if (req.updateFormInfo) {
console.log("Type: FORM INFO");
console.log(`Title: ${req.updateFormInfo.info.title}`);
} else if (req.createItem?.item) {
const item = req.createItem.item;
if (item.questionItem) {
console.log("Type: QUESTION");
console.log(`Title: ${item.title?.substring(0, 60)}...`);
console.log(`\nπ Structure check:`);
console.log(` - 'required' at item level: ${item.required !== undefined ? 'β YES (WRONG!)' : 'β
NO (correct)'}`);
console.log(` - 'required' in question: ${item.questionItem?.question?.required !== undefined ? 'β
YES (correct)' : 'β NO (WRONG!)'}`);
console.log(`\nπ Item keys:`, Object.keys(item));
console.log(`π Question keys:`, Object.keys(item.questionItem?.question || {}));
} else if (item.pageBreakItem) {
console.log("Type: PAGE BREAK");
} else {
console.log("Type: SECTION HEADER");
console.log(`Title: ${item.title}`);
}
}
});
// Mostra un esempio completo
console.log("\n\nβββββββββββββββββββββββββββββββ");
console.log("π FULL EXAMPLE (Request 2):");
console.log("βββββββββββββββββββββββββββββββ\n");
console.log(JSON.stringify(result.requests[2], null, 2));
// Salva anche su file
fs.writeFileSync('/tmp/debug_payload_full.json', JSON.stringify(result, null, 2));
console.log("\n\nπΎ Full payload saved to: /tmp/debug_payload_full.json");
console.log(`π Total requests: ${result.requests.length}`);