From b2c2342d7d2496d3450f3f8567c20ee1cdf6178c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 29 Apr 2020 15:51:10 +0300 Subject: [PATCH] Clear CC issues --- app/jobs/dispute_status_update_job.rb | 5 ++--- app/models/dispute.rb | 7 +++---- app/models/domain.rb | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/jobs/dispute_status_update_job.rb b/app/jobs/dispute_status_update_job.rb index 5f8f1c6b1..c6d048045 100644 --- a/app/jobs/dispute_status_update_job.rb +++ b/app/jobs/dispute_status_update_job.rb @@ -12,16 +12,15 @@ class DisputeStatusUpdateJob < Que::Job end def close_disputes - disputes = Dispute.where(closed: false).where('expires_at < ?', Date.today).all + disputes = Dispute.where(closed: false).where('expires_at < ?', Time.zone.today).all Rails.logger.info "DisputeStatusCloseJob - Found #{disputes.count} closable disputes" disputes.each do |dispute| - puts "attempnt" close_dispute(dispute) end end def activate_disputes - disputes = Dispute.where(closed: false, starts_at: Date.today).all + disputes = Dispute.where(closed: false, starts_at: Time.zone.today).all Rails.logger.info "DisputeStatusCloseJob - Found #{disputes.count} activatable disputes" disputes.each do |dispute| diff --git a/app/models/dispute.rb b/app/models/dispute.rb index a548ba7b5..754fc4208 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -15,8 +15,8 @@ class Dispute < ApplicationRecord before_save :generate_data after_destroy :remove_data - scope :expired, -> { where('expires_at < ?', Date.today) } - scope :active, -> { where('expires_at > ? AND closed = false', Date.today) } + scope :expired, -> { where('expires_at < ?', Time.zone.today) } + scope :active, -> { where('expires_at > ? AND closed = false', Time.zone.today) } scope :closed, -> { where(closed: true) } alias_attribute :name, :domain_name @@ -41,7 +41,7 @@ class Dispute < ApplicationRecord end def generate_data - return if starts_at > Date.today + return if starts_at > Time.zone.today wr = Whois::Record.find_or_initialize_by(name: domain_name) if for_active_domain? @@ -58,7 +58,6 @@ class Dispute < ApplicationRecord return false unless update(closed: true) return if Dispute.active.where(domain_name: domain_name).any? - puts "PASS" whois_record = Whois::Record.find_or_initialize_by(name: domain_name) return true if remove_whois_data(whois_record) diff --git a/app/models/domain.rb b/app/models/domain.rb index 011d02ec7..229e806fb 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -294,7 +294,7 @@ class Domain < ApplicationRecord def renewable? if Setting.days_to_renew_domain_before_expire != 0 # if you can renew domain at days_to_renew before domain expiration - if (expire_time.to_date - Date.today) + 1 > Setting.days_to_renew_domain_before_expire + if (expire_time.to_date - Time.zone.today) + 1 > Setting.days_to_renew_domain_before_expire return false end end