Browse Source

Fixes #4361: Trigger with date-action "relative" not working with weeks

Stubenhocker1399 1 year ago
parent
commit
628ba836eb
2 changed files with 9 additions and 0 deletions
  1. 2 0
      lib/time_range_helper.rb
  2. 7 0
      spec/models/ticket_spec.rb

+ 2 - 0
lib/time_range_helper.rb

@@ -11,6 +11,8 @@ class TimeRangeHelper
       from += value.minutes
     when 'hour'
       from += value.hours
+    when 'week'
+      from += value.weeks
     when 'month'
       from += value.months
     when 'year'

+ 7 - 0
spec/models/ticket_spec.rb

@@ -590,6 +590,13 @@ RSpec.describe Ticket, type: :model do
 
           include_examples 'verify'
         end
+
+        context 'and value in weeks' do
+          let(:relative_value) { 2 }
+          let(:relative_range) { :weeks }
+
+          include_examples 'verify'
+        end
       end
 
       context 'with "ticket.action" => { "value" => "delete" } in "perform" hash' do