update to handle extreme cases when cross platform
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
"webpack:test": "webpack --config tests/test.webpack.config.js",
|
||||
"webpack:prod": "webpack --mode production",
|
||||
"webpack:dev": "webpack",
|
||||
"rename-dist": "mv dist/main.js dist/bafybeianaylvcqh42l7pitsboznlpni3b2gqh2n6jbldmm6oty36ldisra.js"
|
||||
"rename-dist": "mv dist/main.js dist/bafybeibtgoqe4p7m5ykahwzrqlib6nqeqk7lypai5f6x5zymdkihs7gc4u.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
|
@ -37,15 +37,21 @@ export async function submission(roundNumber: number) : Promise<string | void> {
|
||||
console.log(`[SUBMISSION] Fetching submission data for round ${roundNumber}. and submission roundnumber ${submissionRoundNumber}`);
|
||||
const result = await orcaClient.podCall(`submission/${submissionRoundNumber}`);
|
||||
let submission;
|
||||
|
||||
console.log("[SUBMISSION] Submission result:", result.data);
|
||||
|
||||
console.log("[SUBMISSION] Submission result:", result);
|
||||
console.log("[SUBMISSION] Submission result data:", result.data);
|
||||
|
||||
if (!result || result.data === "No submission") {
|
||||
console.log("[SUBMISSION] No existing submission found");
|
||||
return status.NO_SUBMISSION_BUT_SUBMISSION_CALLED;
|
||||
} else {
|
||||
// Add extra error handling for https://koii-workspace.slack.com/archives/C0886H01JM8/p1746137232538419
|
||||
submission = typeof result.data === 'object' && 'data' in result.data ? result.data.data : result.data;
|
||||
if (typeof result.data === 'object' && 'data' in result.data) {
|
||||
console.log("[SUBMISSION] Submission result data is an object with 'data' property");
|
||||
submission = result.data.data;
|
||||
} else {
|
||||
console.log("[SUBMISSION] Submission result data is not an object with 'data' property");
|
||||
submission = result.data;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("[SUBMISSION] Validating submission data...");
|
||||
|
@ -69,10 +69,24 @@ export async function audit(cid: string, roundNumber: number, submitterKey: stri
|
||||
console.log(`[AUDIT] Audit result:`, auditResult);
|
||||
const auditResultJson = await auditResult.json();
|
||||
console.log(`[AUDIT] Audit result JSON:`, auditResultJson);
|
||||
// Add extra error handling for https://koii-workspace.slack.com/archives/C0886H01JM8/p1746137232538419
|
||||
// check if this .data have success, if not check .data.data have success
|
||||
let auditResultDataJson;
|
||||
if (typeof auditResult.data === 'object' && 'success' in auditResult.data) {
|
||||
console.log("[AUDIT] Audit result data is an object with 'success' property");
|
||||
auditResultDataJson = auditResult.data;
|
||||
} else if (typeof auditResult.data === 'object' && 'data' in auditResult.data && 'success' in auditResult.data.data) {
|
||||
console.log("[AUDIT] Audit result data is an object with 'data' property and 'success' property");
|
||||
auditResultDataJson = auditResult.data.data;
|
||||
} else {
|
||||
console.log(`[AUDIT] ❌ Audit result is not a valid object`);
|
||||
return true;
|
||||
}
|
||||
console.log("[AUDIT] Audit result data JSON:", auditResultDataJson);
|
||||
|
||||
if (auditResult.data.success) {
|
||||
if (auditResultDataJson.success) {
|
||||
console.log(`[AUDIT] ✅ Audit successful for ${submitterKey}`);
|
||||
return auditResult.data.data.is_approved;
|
||||
return auditResultDataJson.data.is_approved;
|
||||
} else {
|
||||
console.log(`[AUDIT] ❌ Audit could not be completed for ${submitterKey}`);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user