diff --git a/wherehows-web/app/components/dataset-compliance.js b/wherehows-web/app/components/dataset-compliance.js index 20d386b3e3..097b00f01b 100644 --- a/wherehows-web/app/components/dataset-compliance.js +++ b/wherehows-web/app/components/dataset-compliance.js @@ -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; diff --git a/wherehows-web/app/constants/metadata-acquisition.ts b/wherehows-web/app/constants/metadata-acquisition.ts index 1df994359f..ba3da535b8 100644 --- a/wherehows-web/app/constants/metadata-acquisition.ts +++ b/wherehows-web/app/constants/metadata-acquisition.ts @@ -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.} @@ -350,6 +359,7 @@ export { logicalTypesForIds, logicalTypesForGeneric, getDefaultLogicalType, - SuggestionIntent, + lastSeenSuggestionInterval, + SuggestionIntent lowQualitySuggestionConfidenceThreshold };