From baa6972a62b6c3645f1eb14e73e1deccdf931f60 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 24 May 2020 14:02:30 -0700 Subject: [PATCH] Fixed: Rejections custom filter for Interactive Search (now Rejections Count) --- frontend/src/Store/Actions/releaseActions.js | 31 ++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/frontend/src/Store/Actions/releaseActions.js b/frontend/src/Store/Actions/releaseActions.js index 537ef278e..e024e248d 100644 --- a/frontend/src/Store/Actions/releaseActions.js +++ b/frontend/src/Store/Actions/releaseActions.js @@ -80,6 +80,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; + } } }, @@ -128,8 +155,8 @@ export const defaultState = { valueType: filterBuilderValueTypes.QUALITY }, { - name: 'rejections', - label: 'Rejections', + name: 'rejectionCount', + label: 'Rejection Count', type: filterBuilderTypes.NUMBER } ],