diff --git a/frontend/src/Store/Actions/releaseActions.js b/frontend/src/Store/Actions/releaseActions.js index dd114f74a..4c030ead2 100644 --- a/frontend/src/Store/Actions/releaseActions.js +++ b/frontend/src/Store/Actions/releaseActions.js @@ -92,6 +92,33 @@ export const defaultState = { // Default to false return false; + }, + + rejectionCount: function(item, value, type) { + const rejectionCount = item.rejections.length; + + switch (type) { + case filterTypes.EQUAL: + return rejectionCount === value; + + case filterTypes.GREATER_THAN: + return rejectionCount > value; + + case filterTypes.GREATER_THAN_OR_EQUAL: + return rejectionCount >= value; + + case filterTypes.LESS_THAN: + return rejectionCount < value; + + case filterTypes.LESS_THAN_OR_EQUAL: + return rejectionCount <= value; + + case filterTypes.NOT_EQUAL: + return rejectionCount !== value; + + default: + return false; + } } }, @@ -140,8 +167,8 @@ export const defaultState = { valueType: filterBuilderValueTypes.QUALITY }, { - name: 'rejections', - label: 'Rejections', + name: 'rejectionCount', + label: 'Rejection Count', type: filterBuilderTypes.NUMBER } ],