forked from p15670423/monkey
Refactored code of rule ordering
This commit is contained in:
parent
a818025f63
commit
761ed2ec43
|
@ -29,19 +29,12 @@ function compareRules(firstRule, secondRule) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function compareRuleStatuses(ruleStatusOne, ruleStatusTwo) {
|
function compareRuleStatuses(ruleStatusOne, ruleStatusTwo) {
|
||||||
if (ruleStatusOne === ruleStatusTwo) {
|
const severity_order = {
|
||||||
return 0;
|
[STATUSES.STATUS_FAILED]: 1,
|
||||||
} else if (ruleStatusOne === STATUSES.STATUS_FAILED) {
|
[STATUSES.STATUS_VERIFY]: 2,
|
||||||
return -1;
|
[STATUSES.STATUS_PASSED]: 3,
|
||||||
} else if (ruleStatusTwo === STATUSES.STATUS_FAILED) {
|
[STATUSES.STATUS_UNEXECUTED]: 4
|
||||||
return 1;
|
|
||||||
} else if (ruleStatusOne === STATUSES.STATUS_VERIFY) {
|
|
||||||
return -1;
|
|
||||||
} else if (ruleStatusTwo === STATUSES.STATUS_VERIFY) {
|
|
||||||
return 1;
|
|
||||||
} else if (ruleStatusOne === STATUSES.STATUS_PASSED) {
|
|
||||||
return -1;
|
|
||||||
} else if (ruleStatusTwo === STATUSES.STATUS_PASSED) {
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return severity_order[ruleStatusOne] - severity_order[ruleStatusTwo]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue