优化
This commit is contained in:
@@ -39,14 +39,15 @@ export async function run(context) {
|
||||
if (overview?.pda) {
|
||||
const expectsPhotos = fixture === context.createdResources?.phase3Loading
|
||||
&& Array.isArray(fixture?.evidenceTypes) && fixture.evidenceTypes.length > 0
|
||||
const requiredFields = ['taskId', 'taskStatus', 'taskVersion', 'itemCount', 'completedItemCount', 'unresolvedItemCount']
|
||||
const missingFields = requiredFields.filter((field) => overview.pda[field] === undefined)
|
||||
context.assert(MODULE, 'overview PDA 摘要字段完整', overviewResponse,
|
||||
['taskId', 'taskStatus', 'taskVersion', 'itemCount', 'completedItemCount', 'unresolvedItemCount']
|
||||
.every((field) => overview.pda[field] !== undefined)
|
||||
missingFields.length === 0
|
||||
&& Array.isArray(overview.pda.photoCounts)
|
||||
&& Array.isArray(overview.pda.photos)
|
||||
&& Array.isArray(overview.pda.exceptionReasons)
|
||||
&& (!expectsPhotos || overview.pda.photos.length > 0),
|
||||
`taskId=${id(overview.pda.taskId)}, photos=${overview.pda.photos.length}`, OPTIONS)
|
||||
`taskId=${id(overview.pda.taskId)}, photos=${overview.pda.photos?.length ?? 'not-array'}, missingFields=${missingFields.join('|') || 'none'}, photoCountsArray=${Array.isArray(overview.pda.photoCounts)}, photosArray=${Array.isArray(overview.pda.photos)}, exceptionReasonsArray=${Array.isArray(overview.pda.exceptionReasons)}`, OPTIONS)
|
||||
for (const [index, photo] of overview.pda.photos.entries()) {
|
||||
context.assert(MODULE, `overview PDA 照片摘要 ${index + 1} 字段完整`, overviewResponse,
|
||||
['evidenceId', 'fileId', 'status', 'downloadPath'].every((field) => photo[field] !== undefined),
|
||||
|
||||
Reference in New Issue
Block a user