From 667350854fc8d2fba49dd79ec88fbde147d94bd9 Mon Sep 17 00:00:00 2001 From: Peter Silva Date: Fri, 13 Sep 2024 18:26:08 -0400 Subject: [PATCH] fix #1219 convert v2 time offsets to sr3 correctly --- sarracenia/sr.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sarracenia/sr.py b/sarracenia/sr.py index f3bacf728..dcedad1c1 100755 --- a/sarracenia/sr.py +++ b/sarracenia/sr.py @@ -2858,10 +2858,18 @@ def convert1(self,cfg): continue if len(line) > 1: + found_a_date=False for p in convert_patterns_to_v3: while p in line[1]: line[1] = line[1].replace(p,convert_patterns_to_v3[p]) - + found_a_date=True + # hacky way to do it, but covers all cases present in v2 cluster. + if found_a_date: + for o in [ '-1D', '-2D', '-3D', '-1H' ]: + if line[1].endswith(o+'}'): + line[1] = line[1].replace(o,'') + line[1] = line[1].replace('${','${%o' + o.lower() ) + if not pos_args_present and re.search( r'\${[0-9]}', ' '.join(line[1:]) ): pos_args_present=True v3_cfg.write('sundew_compat_regex_first_match_is_zero True\n')