Module: TaskManager

Defined in:
lib/task-manager.rb,
lib/task-manager/engine.rb,
lib/task-manager/version.rb,
app/models/task_manager/plan.rb,
app/models/task_manager/task.rb,
app/models/task_manager/callable.rb,
lib/task-manager/api_constraints.rb,
app/models/task_manager/assignable.rb,
lib/task-manager/deadline_calculator.rb,
app/helpers/task_manager/application_helper.rb,
app/serializers/task_manager/plan_serializer.rb,
app/serializers/task_manager/task_serializer.rb,
app/controllers/task_manager/application_controller.rb,
app/controllers/task_manager/api/v1/plans_controller.rb,
app/controllers/task_manager/api/v1/tasks_controller.rb

Defined Under Namespace

Modules: Api, ApplicationHelper, DeadlineCalculator Classes: ApiConstraints, ApplicationController, Assignable, Callable, Engine, Plan, PlanSerializer, Task, TaskSerializer

Constant Summary collapse

VERSION =
"0.1.7"

Class Method Summary collapse

Class Method Details

.expire_tasksObject

找到刚刚过期的计划任务,然后调用TaskManager::Task#expire



23
24
25
26
27
28
# File 'lib/task-manager.rb', line 23

def self.expire_tasks
  tasks = Task.just_expired
  tasks.each(&:expire)

  tasks
end

.finish_autocompletable_tasksObject



38
39
40
# File 'lib/task-manager.rb', line 38

def self.finish_autocompletable_tasks
  Task.autocompletable.just_expired.each(&:finish)
end

.generate_tasksObject

创建计划任务

首先,获取所有需要生成计划任务的计划,参见TaskManager::Plan.active。 然后调用TaskManager::Plan#generate_tasks生成计划任务。



18
19
20
# File 'lib/task-manager.rb', line 18

def self.generate_tasks
  Plan.active.collect(&:generate_tasks).flatten
end

.remind_assignees_of_expiring_tasksObject

通知任务执行者,任务即将到期。参见TaskManager::Task#remind



31
32
33
34
35
36
# File 'lib/task-manager.rb', line 31

def self.remind_assignees_of_expiring_tasks
  tasks = Task.remindable
  tasks.each(&:remind)

  tasks
end