debug: 添加权重指示器调试信息
- 在 SegmentWeightIndicator 中添加控制台日志 - 调试匹配规则识别和权重过滤逻辑 - 帮助定位分类数量显示错误的根本原因
This commit is contained in:
parent
7fdd95bbb4
commit
6c44d31666
|
|
@ -59,18 +59,35 @@ export const SegmentWeightIndicator: React.FC<SegmentWeightIndicatorProps> = ({
|
||||||
// 计算权重摘要 - 只统计实际选择的分类
|
// 计算权重摘要 - 只统计实际选择的分类
|
||||||
let relevantWeights: Record<string, number> = {};
|
let relevantWeights: Record<string, number> = {};
|
||||||
|
|
||||||
|
console.log('SegmentWeightIndicator Debug:', {
|
||||||
|
segmentMatchingRule,
|
||||||
|
isPriorityOrder: segmentMatchingRule ? SegmentMatchingRuleHelper.isPriorityOrder(segmentMatchingRule) : false,
|
||||||
|
allWeights: weights,
|
||||||
|
allWeightsCount: Object.keys(weights).length
|
||||||
|
});
|
||||||
|
|
||||||
if (segmentMatchingRule && SegmentMatchingRuleHelper.isPriorityOrder(segmentMatchingRule)) {
|
if (segmentMatchingRule && SegmentMatchingRuleHelper.isPriorityOrder(segmentMatchingRule)) {
|
||||||
// 对于按顺序匹配规则,只统计选择的分类
|
// 对于按顺序匹配规则,只统计选择的分类
|
||||||
const selectedCategoryIds = typeof segmentMatchingRule === 'object' && 'PriorityOrder' in segmentMatchingRule
|
const selectedCategoryIds = typeof segmentMatchingRule === 'object' && 'PriorityOrder' in segmentMatchingRule
|
||||||
? segmentMatchingRule.PriorityOrder.category_ids
|
? segmentMatchingRule.PriorityOrder.category_ids
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
|
console.log('PriorityOrder Debug:', {
|
||||||
|
selectedCategoryIds,
|
||||||
|
selectedCount: selectedCategoryIds.length
|
||||||
|
});
|
||||||
|
|
||||||
// 只包含选择的分类的权重
|
// 只包含选择的分类的权重
|
||||||
relevantWeights = Object.fromEntries(
|
relevantWeights = Object.fromEntries(
|
||||||
Object.entries(weights).filter(([classificationId]) =>
|
Object.entries(weights).filter(([classificationId]) =>
|
||||||
selectedCategoryIds.includes(classificationId)
|
selectedCategoryIds.includes(classificationId)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log('Filtered weights:', {
|
||||||
|
relevantWeights,
|
||||||
|
relevantCount: Object.keys(relevantWeights).length
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// 对于其他规则类型,使用所有权重
|
// 对于其他规则类型,使用所有权重
|
||||||
relevantWeights = weights;
|
relevantWeights = weights;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue