feat(generator): enhance buildArtifact with determineArtifactStatus integration
- Change function signature to accept destructured object parameter - Integrate determineArtifactStatus for automatic status calculation - Use REPORT_NAME and COLUMNS constants (to be defined in Task 6) - Add proper filtering for partial_reasons (exclude api_/validation_ prefixes) - Add deduplication for reasons array - Update call site in buildBrowserEntrypointResult to use new signature 🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
@@ -333,11 +333,11 @@ function determineArtifactStatus({{ blockedReason = '', fatalError = '', reasons
|
|||||||
return 'ok';
|
return 'ok';
|
||||||
}}
|
}}
|
||||||
|
|
||||||
function buildArtifact(args, rows) {{
|
function buildArtifact({{ status, blockedReason = '', fatalError = '', reasons = [], rows = [], args }}) {{
|
||||||
return {{
|
return {{
|
||||||
type: 'report-artifact',
|
type: 'report-artifact',
|
||||||
report_name: '{scene_id}',
|
report_name: REPORT_NAME,
|
||||||
status: rows.length > 0 ? 'ok' : 'empty',
|
status: status || determineArtifactStatus({{ blockedReason, fatalError, reasons, rows }}),
|
||||||
period: {{
|
period: {{
|
||||||
mode: args.period_mode,
|
mode: args.period_mode,
|
||||||
mode_code: args.period_mode_code,
|
mode_code: args.period_mode_code,
|
||||||
@@ -346,11 +346,11 @@ function buildArtifact(args, rows) {{
|
|||||||
}},
|
}},
|
||||||
org: {{ label: args.org_label, code: args.org_code }},
|
org: {{ label: args.org_label, code: args.org_code }},
|
||||||
column_defs: COLUMN_DEFS,
|
column_defs: COLUMN_DEFS,
|
||||||
columns: {columns_json},
|
columns: COLUMNS,
|
||||||
rows,
|
rows,
|
||||||
counts: {{ detail_rows: rows.length }},
|
counts: {{ detail_rows: rows.length }},
|
||||||
partial_reasons: [],
|
partial_reasons: reasons.filter(r => r && !r.startsWith('api_') && !r.startsWith('validation_')),
|
||||||
reasons: []
|
reasons: Array.from(new Set(reasons.filter(Boolean)))
|
||||||
}};
|
}};
|
||||||
}}
|
}}
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ async function buildBrowserEntrypointResult(args, deps = defaultDeps) {{
|
|||||||
try {{
|
try {{
|
||||||
const rawData = await (deps.queryData ? deps.queryData(args) : Promise.resolve([]));
|
const rawData = await (deps.queryData ? deps.queryData(args) : Promise.resolve([]));
|
||||||
const rows = normalizeRows(rawData);
|
const rows = normalizeRows(rawData);
|
||||||
return buildArtifact(args, rows);
|
return buildArtifact({{ args, rows }});
|
||||||
}} catch (error) {{
|
}} catch (error) {{
|
||||||
return {{
|
return {{
|
||||||
type: 'report-artifact',
|
type: 'report-artifact',
|
||||||
|
|||||||
Reference in New Issue
Block a user