mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-17 03:48:15 +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,
|
logicalTypesForIds,
|
||||||
logicalTypesForGeneric,
|
logicalTypesForGeneric,
|
||||||
hasPredefinedFieldFormat,
|
hasPredefinedFieldFormat,
|
||||||
getDefaultLogicalType
|
getDefaultLogicalType,
|
||||||
|
lastSeenSuggestionInterval
|
||||||
} from 'wherehows-web/constants';
|
} from 'wherehows-web/constants';
|
||||||
import {
|
import {
|
||||||
isPolicyExpectedShape,
|
isPolicyExpectedShape,
|
||||||
@ -332,10 +333,11 @@ export default Component.extend({
|
|||||||
]);
|
]);
|
||||||
const { lastModified: suggestionsLastModified, complianceSuggestions = [] } = complianceSuggestion;
|
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
|
// and we have at least 1 suggestion, otherwise check that the count of suggestions is at least 1
|
||||||
if (policyModificationTimeInEpoch && suggestionsLastModified) {
|
if (policyModificationTimeInEpoch && suggestionsLastModified) {
|
||||||
return complianceSuggestions.length && suggestionsLastModified > policyModificationTimeInEpoch;
|
const suggestionIsUnseen = suggestionsLastModified - policyModificationTimeInEpoch >= lastSeenSuggestionInterval;
|
||||||
|
return complianceSuggestions.length && suggestionIsUnseen;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!complianceSuggestions.length;
|
return !!complianceSuggestions.length;
|
||||||
|
@ -44,12 +44,21 @@ interface IFieldIdTypes {
|
|||||||
[prop: string]: IFieldIdProps;
|
[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
|
* Percentage value for a compliance policy suggestion with a low confidence score
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
const lowQualitySuggestionConfidenceThreshold = 0.5;
|
const lowQualitySuggestionConfidenceThreshold = 0.5;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of id logical types
|
* A list of id logical types
|
||||||
* @type {Array.<String>}
|
* @type {Array.<String>}
|
||||||
@ -350,6 +359,7 @@ export {
|
|||||||
logicalTypesForIds,
|
logicalTypesForIds,
|
||||||
logicalTypesForGeneric,
|
logicalTypesForGeneric,
|
||||||
getDefaultLogicalType,
|
getDefaultLogicalType,
|
||||||
SuggestionIntent,
|
lastSeenSuggestionInterval,
|
||||||
|
SuggestionIntent
|
||||||
lowQualitySuggestionConfidenceThreshold
|
lowQualitySuggestionConfidenceThreshold
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user