Skip Menu |

This queue is for tickets about the RT-Extension-RepeatTicket CPAN distribution.

Report information
The Basics
Id: 133565
Status: new
Priority: 0/
Queue: RT-Extension-RepeatTicket

People
Owner: Nobody in particular
Requestors: sjccocit [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Failed complete date check
Date: Mon, 19 Oct 2020 17:00:12 -0400
To: bug-RT-Extension-RepeatTicket [...] rt.cpan.org
From: StJohns Clerk <sjccocit [...] gmail.com>
Hello, We use the RepeatTicket extension regularly with a variety of daily and weekly tickets, but we have some tickets that need to be repeated bi-annually (every 2 years). This recurrence doesn't seem to be working. This is how we have one of the tickets setup: Ticket lead time: 60 days Concurrent active tickets: 1 Recurrence pattern: Yearly Create new task 2 year(s) after each task is completed Start: 2018-12-13 No end date We noticed these tickets didn't get repeated as expected last week and looking in the debug log we see the message "Failed complete date check (/opt/rt4/local/plugins/RT-Extension-RepeatTicket/lib/RT/Extension/RepeatTicket.pm:406)". This is the entire info/debug entry: [75535] [Mon Oct 19 19:44:50 2020] [debug]: Using internal Perl HTML -> text conversion (/opt/rt4/lib/RT/Interface/Email.pm:1479) [75535] [Mon Oct 19 19:44:50 2020] [info]: Repeating ticket 180 (/opt/rt4/local/plugins/RT-Extension-RepeatTicket/bin/rt-repeat-ticket:41) [75535] [Mon Oct 19 19:44:50 2020] [debug]: Checking date 2020-10-19 with adjusted lead time date 2020-12-14 (/opt/rt4/local/plugins/RT-Extension-RepeatTicket/lib/RT/Extension/RepeatTicket.pm:180) [75535] [Mon Oct 19 19:44:50 2020] [debug]: RT::Date used Time::ParseDate to make '2018-12-13' 1544677200 (/opt/rt4/lib/RT/Date.pm:274) [75535] [Mon Oct 19 19:44:50 2020] [debug]: Failed complete date check (/opt/rt4/local/plugins/RT-Extension-RepeatTicket/lib/RT/Extension/RepeatTicket.pm:406) I inserted a few "print" statements into RepeatTicket.pm just to see what the variables looked like in the "CheckCompleteDate" sub and we see this: Lifecycle: RT::Lifecycle::Ticket=HASH(0xa46f700) Checkday: 2020-10-19T00:00:00 Span: 2 Date: 2018-10-19T00:00:00 Type: year Resolved: RT::Date=HASH(0xa46f238) RT-Extension-RepeatTicket-1.11 RT version 4.4.3 Perl version 5.26.2 OS: CentOS Linux release 7.8.2003 Any help or hints as to what the issue might be? Thank you!
Subject: Re: [rt.cpan.org #133565] AutoReply: Failed complete date check
Date: Fri, 23 Oct 2020 10:47:30 -0400
To: bug-RT-Extension-RepeatTicket [...] rt.cpan.org
From: StJohns Clerk <sjccocit [...] gmail.com>
I've been testing/troubleshooting this and I'm not sure if I'm on the right track or not, but I suspect the problem is with the 'CheckCompleteDate' sub and how it deals with the "yearly" types of repeating tickets. In my testing, this is what I have found: The 'CheckCompleteDate' sub gets called from the 'Repeat' sub on line 400 with the following arguments like so: unless ( CheckCompleteDate(2020-10-22T00:00:00, 180, 'year', 2 ) When CheckCompleteDate runs, $checkday comes in as 2020-10-22T00:00:00 (a.k.a. the current date since no date arguments have been passed in), $ticket is 180, $type is 'year' and $span is 2. The $date variable gets set as a copy of $checkday so it is also set to 2020-10-22T00:00:00. $resolved gets set to the 'ResolvedObj' of ticket 180. $resolved->Date then becomes the resolved date of the original ticket which is 2018-12-14. The 'if ($span)' statement on line 751 then does the subtract operation and subtracts 2 years from 2020-10-22 which leaves us with 2018-10-22 now being assigned to the $date variable. Per line 755, the sub will return 0 if $resolved->Date is greater than $date->ymd so in my test case: "if 2018-12-14 is greater than 2018-10-22" which of course is true, so it returns 0 to the calling subroutine. Back on line 403, the "unless" statement receives a return code of zero so we log the debug entry of "Failed complete date check" and exit. In this scenario, CheckCompleteDate will always return a 0 unless $span is equal to 1 or until $date is a future date that is past the due date. In which case, the task will already be overdue and repeating the ticket with a lead time doesn't serve its purpose. I also noticed that the lead time set for the recurrence never comes into play with the CheckCompleteDate sub so I experimented with changing how that sub is called like so: unless ( CheckCompleteDate($checkday, $last_ticket, 'year', $content->{'repeat-details-yearly-complete'} ) Calling CheckCompleteDate with $checkday instead of $original_date seems to fix this particular issue since the value of $checkday is already set to the correct date including the required lead time: unless ( CheckCompleteDate(2020-12-22T00:00:00, 180, 'year', 2 ) Now when CheckCompleteDate runs, it subtracts 2 years from 2020-12-22 which leaves us with 2018-12-22 and when we compare this with original resolved date of 2018-12-14, the 'gt' test comes back as false and returns the '1' back to the calling subroutine and subsequently repeats/creates the new ticket as expected. I just don't know if this is a viable option since I don't fully understand the ramifications of changing $original_date to $checkday when calling the CheckCompleteDate subroutine. Is this required everywhere CheckCompleteDate is called or just when dealing with 'yearly' repetitions? Maybe a better option would be to add a little bit of logic prior to calling CheckCompleteDate? Maybe something similar to line 178: $original_date = $original_date->add( days => $content->{'repeat-lead-time'} ) if defined $content->{'repeat-lead-time'} just before calling CheckCompleteDate wherever it's called is an option? I'm obviously no expert here, just trying to figure it out and help if I can. Thank you again. On Mon, Oct 19, 2020 at 5:01 PM Bugs in RT-Extension-RepeatTicket via RT <bug-RT-Extension-RepeatTicket@rt.cpan.org> wrote: Show quoted text
> > > Greetings, > > This message has been automatically generated in response to the > creation of a trouble ticket regarding: > "Failed complete date check", > a summary of which appears below. > > There is no need to reply to this message right now. Your ticket has been > assigned an ID of [rt.cpan.org #133565]. Your ticket is accessible > on the web at: > > https://rt.cpan.org/Ticket/Display.html?id=133565 > > Please include the string: > > [rt.cpan.org #133565] > > in the subject line of all future correspondence about this issue. To do so, > you may reply to this message. > > Thank you, > bug-RT-Extension-RepeatTicket@rt.cpan.org > > ------------------------------------------------------------------------- > Hello, > > We use the RepeatTicket extension regularly with a variety of daily and > weekly tickets, but we have some tickets that need to be repeated > bi-annually (every 2 years). This recurrence doesn't seem to be working. > > This is how we have one of the tickets setup: > Ticket lead time: 60 days > Concurrent active tickets: 1 > Recurrence pattern: Yearly > Create new task 2 year(s) after each task is completed > Start: 2018-12-13 > No end date > > We noticed these tickets didn't get repeated as expected last week and > looking in the debug log we see the message "Failed complete date check > (/opt/rt4/local/plugins/RT-Extension-RepeatTicket/lib/RT/Extension/RepeatTicket.pm:406)". > > This is the entire info/debug entry: > > [75535] [Mon Oct 19 19:44:50 2020] [debug]: Using internal Perl HTML -> > text conversion (/opt/rt4/lib/RT/Interface/Email.pm:1479) > [75535] [Mon Oct 19 19:44:50 2020] [info]: Repeating ticket 180 > (/opt/rt4/local/plugins/RT-Extension-RepeatTicket/bin/rt-repeat-ticket:41) > [75535] [Mon Oct 19 19:44:50 2020] [debug]: Checking date 2020-10-19 with > adjusted lead time date 2020-12-14 > (/opt/rt4/local/plugins/RT-Extension-RepeatTicket/lib/RT/Extension/RepeatTicket.pm:180) > [75535] [Mon Oct 19 19:44:50 2020] [debug]: RT::Date used Time::ParseDate > to make '2018-12-13' 1544677200 (/opt/rt4/lib/RT/Date.pm:274) > [75535] [Mon Oct 19 19:44:50 2020] [debug]: Failed complete date check > (/opt/rt4/local/plugins/RT-Extension-RepeatTicket/lib/RT/Extension/RepeatTicket.pm:406) > > I inserted a few "print" statements into RepeatTicket.pm just to see what > the variables looked like in the "CheckCompleteDate" sub and we see this: > > Lifecycle: RT::Lifecycle::Ticket=HASH(0xa46f700) > Checkday: 2020-10-19T00:00:00 > Span: 2 > Date: 2018-10-19T00:00:00 > Type: year > Resolved: RT::Date=HASH(0xa46f238) > > > RT-Extension-RepeatTicket-1.11 > RT version 4.4.3 > Perl version 5.26.2 > OS: CentOS Linux release 7.8.2003 > > Any help or hints as to what the issue might be? > > Thank you!
-- Please do not reply to this email. For questions contact helpdesk@stjohnsclerk.com