<commit_before># encoding: UTF-8

# $HeadURL$
# $Id$
#
# Copyright (c) 2009-2012 by Public Library of Science, a non-profit corporation
# http://www.plos.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

namespace :mailer do

  desc "Send error report"
  task :error_report => :environment do
    report = Report.find_by_name("error_report")
    report.send_error_report
    puts "Error report sent to #{report.users.count} subscriber(s)"
  end

  desc "Send status report"
  task :status_report => :environment do
    report = Report.find_by_name("status_report")
    report.send_status_report
    puts "Status report sent to #{report.users.count} subscriber(s)"
  end

  desc "Send article statistics report"
  task :article_statistics_report => :environment do
    report = Report.find_by_name("article_statistics_report")
    report.send_article_statistics_report
    puts "Article statistics report sent to #{report.users.count} subscriber(s)"
  end

  desc 'Send all scheduled mails'
  task :all => [:environment, :error_report, :article_statistics_report, :status_report]
end
<commit_msg>ALM-703 rake task to rename error report<commit_after># encoding: UTF-8

# $HeadURL$
# $Id$
#
# Copyright (c) 2009-2012 by Public Library of Science, a non-profit corporation
# http://www.plos.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

namespace :mailer do

  desc "Send error report"
  task :error_report => :environment do
    report = Report.find_by_name("error_report")
    report.send_error_report
    puts "Error report sent to #{report.users.count} subscriber(s)"
  end

  desc "Send status report"
  task :status_report => :environment do
    report = Report.find_by_name("status_report")
    report.send_status_report
    puts "Status report sent to #{report.users.count} subscriber(s)"
  end

  desc "Send article statistics report"
  task :article_statistics_report => :environment do
    report = Report.find_by_name("article_statistics_report")
    report.send_article_statistics_report
    puts "Article statistics report sent to #{report.users.count} subscriber(s)"
  end

  desc "Rename error report"
  task :rename_report => :environment do
    Report.where(name: "disabled_source_report").delete_all
    fatal_error_report = Report.find_or_create_by_name(
                :name => 'fatal_error_report',
                :display_name => 'Fatal Error Report',
                :description => 'Reports when a fatal error has occured',
                :interval => 0,
                :private => true)
    puts "Reports updated"
  end

  desc 'Send all scheduled mails'
  task :all => [:environment, :error_report, :article_statistics_report, :status_report]
end

{'fraction_non_alphanumeric': 0.089872386641325, 'fraction_numerical': 0.008145533532446375, 'mean_word_length': 3.998643147896879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '4853804', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1035, 'n_words': 378}