From 97b4527f62584f1f5e6ce93b91cad7e5db95c427 Mon Sep 17 00:00:00 2001 From: jgstew Date: Thu, 14 Mar 2024 16:19:02 -0400 Subject: [PATCH] add the site subscription relevance to baseline if over 100 components --- examples/baseline_plugin.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/baseline_plugin.py b/examples/baseline_plugin.py index 6822a1d..22ffa44 100644 --- a/examples/baseline_plugin.py +++ b/examples/baseline_plugin.py @@ -128,7 +128,14 @@ def create_baseline_from_site(site): logging.debug(baseline_components) - baseline_rel = "true" + # only have the baseline be relevant for 60 days after creation: + baseline_rel = f'exists absolute values whose(it < 60 * day) of (current date - "{ datetime.datetime.today().strftime("%d %b %Y") }" as date)' + + if num_items > 100: + site_rel_query = f"""unique value of site level relevances of bes sites whose(exists (it as trimmed string as lowercase) whose(it = "{site_name}" as trimmed string as lowercase) of (display names of it; names of it))""" + site_rel = bes_conn.session_relevance_string(site_rel_query) + + baseline_rel = f"""( {baseline_rel} ) AND ( {site_rel} )""" # # This does not appear to work as expected: # # create baseline relevance such that only relevant if 1+ fixlet is relevant @@ -141,7 +148,8 @@ def create_baseline_from_site(site): Patches from {site_name} - {datetime.datetime.today().strftime('%Y-%m-%d')} - {baseline_rel} + + PT12H {baseline_components}