修复:分类规则仅处理未分类并保留已有归属
This commit is contained in:
@@ -13,7 +13,7 @@ test('blank-key source creates a narrowly scoped rule and preserves inherited de
|
||||
{field:'PDT代码',operator:'IS_BLANK',value:''},
|
||||
{field:'销售片区',operator:'EQUALS',value:'销售区A'},
|
||||
]);
|
||||
assert.equal(result.matchRules[0].stage,'black');assert.deepEqual(result.matchRules[1],defaults[0]);
|
||||
assert.equal(result.matchRules[0].onlyUnclassified,true);assert.equal(result.matchRules[0].stage,'black');assert.deepEqual(result.matchRules[1],defaults[0]);
|
||||
assert.deepEqual(base,{projectGroupLookup:{'001|G':'项目组A'},extra:['keep']});
|
||||
const changed=editClassification(result,selection,'业务组A',defaults);
|
||||
assert.equal(changed.matchRules.length,2);assert.equal(changed.matchRules[0].value,'业务组A');
|
||||
@@ -43,11 +43,11 @@ test('editing a disabled project relationship enables only that relationship and
|
||||
assert.throws(()=>editClassification(base,selection,'不存在的项目组',[]),/未登记/);
|
||||
});
|
||||
|
||||
test('removable conditions apply to all matching rows without an implicit unclassified predicate',()=>{
|
||||
test('removable conditions retain an explicit unclassified-only scope',()=>{
|
||||
const options={stage:'all',conditions:[{field:'@department',operator:'EQUALS',value:'产业部A'},{field:'销售片区',operator:'EQUALS',value:'销售区A'}]};
|
||||
const result=editClassification({matchRules:[]},selection,'G',[],options);
|
||||
assert.deepEqual(result.matchRules[0].conditions,options.conditions);assert.equal(result.matchRules[0].stage,'all');
|
||||
assert.equal(result.matchRules[0].conditions.some(c=>c.field==='@group'),false);
|
||||
assert.equal(result.matchRules[0].onlyUnclassified,true);
|
||||
assert.equal(classificationRuleId(source,options),classificationRuleId(source,{...options,conditions:[...options.conditions].reverse()}));
|
||||
const specific=editClassification({matchRules:[]},selection,'G',[],{stage:'all'});
|
||||
assert.ok(specific.matchRules[0].priority<result.matchRules[0].priority);
|
||||
|
||||
Reference in New Issue
Block a user