mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-14 10:26:51 +00:00
Merge pull request #784 from theseyi/prev-seen
adds num of days window to recent suggestions check
This commit is contained in:
commit
f93bcbbabb
@ -12,7 +12,8 @@ import {
|
||||
logicalTypesForIds,
|
||||
logicalTypesForGeneric,
|
||||
hasPredefinedFieldFormat,
|
||||
getDefaultLogicalType
|
||||
getDefaultLogicalType,
|
||||
lastSeenSuggestionInterval
|
||||
} from 'wherehows-web/constants';
|
||||
import {
|
||||
isPolicyExpectedShape,
|
||||
@ -332,10 +333,11 @@ export default Component.extend({
|
||||
]);
|
||||
const { lastModified: suggestionsLastModified, complianceSuggestions = [] } = complianceSuggestion;
|
||||
|
||||
// If modification dates exist, check that the suggestions are newer than the last time the policy was saved
|
||||
// If modification dates exist, check that the suggestions are considered 'unseen' since the last time the policy was saved
|
||||
// and we have at least 1 suggestion, otherwise check that the count of suggestions is at least 1
|
||||
if (policyModificationTimeInEpoch && suggestionsLastModified) {
|
||||
return complianceSuggestions.length && suggestionsLastModified > policyModificationTimeInEpoch;
|
||||
const suggestionIsUnseen = suggestionsLastModified - policyModificationTimeInEpoch >= lastSeenSuggestionInterval;
|
||||
return complianceSuggestions.length && suggestionIsUnseen;
|
||||
}
|
||||
|
||||
return !!complianceSuggestions.length;
|
||||
|
@ -44,12 +44,21 @@ interface IFieldIdTypes {
|
||||
[prop: string]: IFieldIdProps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Length of time between suggestion modification time and last modified time for the compliance policy
|
||||
* If a policy has been updated within the range of this window then it is considered as stale / or
|
||||
* has been seen previously
|
||||
* @type {number}
|
||||
*/
|
||||
const lastSeenSuggestionInterval: number = 7 * 24 * 60 * 60 * 1000;
|
||||
|
||||
/**
|
||||
* Percentage value for a compliance policy suggestion with a low confidence score
|
||||
* @type {number}
|
||||
*/
|
||||
const lowQualitySuggestionConfidenceThreshold = 0.5;
|
||||
|
||||
|
||||
/**
|
||||
* A list of id logical types
|
||||
* @type {Array.<String>}
|
||||
@ -350,6 +359,7 @@ export {
|
||||
logicalTypesForIds,
|
||||
logicalTypesForGeneric,
|
||||
getDefaultLogicalType,
|
||||
SuggestionIntent,
|
||||
lastSeenSuggestionInterval,
|
||||
SuggestionIntent
|
||||
lowQualitySuggestionConfidenceThreshold
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user