Sha256: 32cb4fb4ab925c66d19a5d4d82cbb49ad475575552bf3fb8aed0eed5b0a49472

Contents?: true

Size: 946 Bytes

Versions: 5

Compression:

Stored size: 946 Bytes

Contents

# -*- encoding: utf-8 -*-

require "enumerize"
require "default_value_for"
require "active_model_serializers"

require "task-manager/api_constraints"
require "task-manager/engine"
require "task-manager/deadline_calculator"
require "task-manager/deadline_validator"

module TaskManager

  # 创建计划任务
  #
  # 首先,获取所有需要生成计划任务的计划,参见{TaskManager::Plan.active}。
  # 然后调用{TaskManager::Plan#generate_tasks}生成计划任务。
  def self.generate_tasks
    Plan.active.collect(&:generate_tasks).flatten
  end

  # 找到刚刚过期的计划任务,然后调用{TaskManager::Task#expire}。
  def self.expire_tasks
    tasks = Task.just_expired
    tasks.each(&:expire)

    tasks
  end

  # 通知任务执行者,任务即将到期。参见{TaskManager::Task#remind}
  def self.remind_assignees_of_expiring_tasks
    tasks = Task.remindable
    tasks.each(&:remind)

    tasks
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
task-manager-0.1.5 lib/task-manager.rb
task-manager-0.1.4 lib/task-manager.rb
task-manager-0.1.3 lib/task-manager.rb
task-manager-0.1.2 lib/task-manager.rb
task-manager-0.1.1 lib/task-manager.rb