From 27651282fdf9473fd6857f23be9d9e8959a244d4 Mon Sep 17 00:00:00 2001 From: Manuel Laug Date: Fri, 10 May 2024 13:04:37 +0200 Subject: [PATCH] Fixes day calculation for grace_period --- app/models/concerns/foreman_expire_hosts/host_ext.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/concerns/foreman_expire_hosts/host_ext.rb b/app/models/concerns/foreman_expire_hosts/host_ext.rb index 7bba2df..bb1315a 100644 --- a/app/models/concerns/foreman_expire_hosts/host_ext.rb +++ b/app/models/concerns/foreman_expire_hosts/host_ext.rb @@ -55,20 +55,20 @@ def expired? def expiration_grace_period_end_date return nil unless expires? - expired_on.to_date + Setting[:days_to_delete_after_host_expiration].to_i + expired_on.to_date + Setting[:days_to_delete_after_host_expiration].to_i.days end def expired_past_grace_period? return false unless expires? - expiration_grace_period_end_date <= Date.today + expiration_grace_period_end_date.to_date <= Date.today end def pending_expiration? return false unless expires? return false if expired? - expired_on - Setting['notify1_days_before_host_expiry'].to_i <= Date.today + expired_on.to_date - Setting['notify1_days_before_host_expiry'].to_i.days <= Date.today end def can_modify_expiry_date?