| | |
| | | int total = items.size(); |
| | | // 合格率的分母只算「能判定」的项,无判定规则的项既不加分也不减分 |
| | | int decidableCount = total - undecidableCount; |
| | | boolean hasPendingItem = items.stream().anyMatch(item -> QualityResult.PENDING_TEXT.equals(item.getResultText())); |
| | | |
| | | QualityResult verdict = null; |
| | | if (!reportRules.isEmpty()) { |
| | | // 缺少检验依据时,即使报告级规则能算出布尔值,也不能生成确定结论。 |
| | | if (!hasPendingItem && !reportRules.isEmpty()) { |
| | | Map<String, Object> scoped = context.scope(items); |
| | | scoped.put("index", 0); |
| | | boolean passed = true; |
| | |
| | | } |
| | | } |
| | | verdict = failed ? null : (passed ? QualityResult.PASS : QualityResult.FAIL); |
| | | } else if (decidableCount > 0) { |
| | | } else if (!hasPendingItem && decidableCount > 0) { |
| | | // 只有「全部可判定项都合格」才给合格结论。无判定规则的项不参与,它们没有对错可言。 |
| | | // 存在待判定项(规则跑挂)时不给结论:没验过不能说合格,没证据也不能说不合格, |
| | | // 否则会出现「结论合格、合格率 0%」这种自相矛盾的报告。 |