resets_pending_time_seconds.rb 505 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. # Ensures pending time is always zero-seconds.
  3. module Ticket::ResetsPendingTimeSeconds
  4. extend ActiveSupport::Concern
  5. included do
  6. before_save :ticket_reset_pending_time_seconds
  7. end
  8. private
  9. def ticket_reset_pending_time_seconds
  10. return true if pending_time.blank?
  11. return true if !pending_time_changed?
  12. return true if pending_time.sec.zero?
  13. self.pending_time = pending_time.change sec: 0
  14. end
  15. end