<commit_before>module LaDepartmentWatcher
  class DepartmentMailer < ActionMailer::Base
    default from: LaDepartmentWatcher::Config.get.config[:notify_from]

    def notify_alert(department)
      @department = department
      @minutes_offline = (LaDepartmentWatcher::Config.get.config[:notify_offset] * (1.0 / 60)).to_i

      alert = department.last_alert

      unless alert.notify_sent?
        alert.update_attributes(notify_sent_at: DateTime.now())
        mail( to: LaDepartmentWatcher::Config.get.config[:notify_to],
              subject: "Department #{department.name} is offline").deliver
      end
    end

    def notify_alert_end(department)
      @department = department
      @alert = department.last_alert
      @minutes_offline = ( @alert.end_at.to_i - @alert.start_at.to_i * (1.0 / 60)).to_i

      mail( to: LaDepartmentWatcher::Config.get.config[:notify_to],
            subject: "Department #{department.name} is online").deliver
    end
  end
end<commit_msg>fix diff of start and end of alert<commit_after>module LaDepartmentWatcher
  class DepartmentMailer < ActionMailer::Base
    default from: LaDepartmentWatcher::Config.get.config[:notify_from]

    def notify_alert(department)
      @department = department
      @minutes_offline = (LaDepartmentWatcher::Config.get.config[:notify_offset] * (1.0 / 60)).to_i

      alert = department.last_alert

      unless alert.notify_sent?
        alert.update_attributes(notify_sent_at: DateTime.now())
        mail( to: LaDepartmentWatcher::Config.get.config[:notify_to],
              subject: "Department #{department.name} is offline").deliver
      end
    end

    def notify_alert_end(department)
      @department = department
      @alert = department.last_alert
      @minutes_offline = ((@alert.end_at.to_i - @alert.start_at.to_i) * (1.0 / 60)).to_i

      mail( to: LaDepartmentWatcher::Config.get.config[:notify_to],
            subject: "Department #{department.name} is online").deliver
    end
  end
end
{'fraction_non_alphanumeric': 0.10943775100401607, 'fraction_numerical': 0.008032128514056224, 'mean_word_length': 3.4786516853932583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '526561', 'n_tokens_mistral': 645, 'n_tokens_neox': 594, 'n_words': 114}