Added rake task for auto create of upcoming workgroup tasks (weekly tasks).
This commit is contained in:
parent
7e2506baa2
commit
d8cdbe4abb
6 changed files with 39 additions and 9 deletions
|
|
@ -13,11 +13,8 @@ class TasksController < ApplicationController
|
|||
|
||||
def new
|
||||
if params[:id]
|
||||
group = Group.find(params[:id])
|
||||
@task = group.tasks.build :name => group.task_name,
|
||||
:required_users => group.task_required_users,
|
||||
:description => group.task_description,
|
||||
:due_date => group.next_weekly_tasks[params[:task_from_now].to_i]
|
||||
group = Workgroup.find(params[:id])
|
||||
@task = group.tasks.build(group.task_attributes(group.next_weekly_tasks[params[:task_from_now].to_i]))
|
||||
else
|
||||
@task = Task.new
|
||||
end
|
||||
|
|
|
|||
|
|
@ -55,9 +55,19 @@ class Workgroup < Group
|
|||
nextTasks = Array.new
|
||||
number.times do
|
||||
nextTasks << nextTask
|
||||
nextTask = 1.week.from_now(nextTask)
|
||||
nextTask = 1.week.from_now(nextTask).to_date
|
||||
end
|
||||
return nextTasks
|
||||
end
|
||||
|
||||
def task_attributes(date)
|
||||
{
|
||||
:name => task_name,
|
||||
:description => task_description,
|
||||
:due_date => date,
|
||||
:required_users => task_required_users,
|
||||
:weekly => true
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
= form.error_messages
|
||||
= form.hidden_field :weekly
|
||||
%p
|
||||
%b Name
|
||||
%br/
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
%th Wer machts?
|
||||
%th Aufgabe übernehmen
|
||||
- i = 0
|
||||
- for next_task in @group.next_weekly_tasks
|
||||
- for next_date in @group.next_weekly_tasks
|
||||
%tr{:class => cycle("even","odd")}
|
||||
%td= I18n.l next_task, :format => "%a, %d.%m.%Y"
|
||||
- if task = @group.tasks.find(:first, :conditions => ["due_date = ? AND name = ?",next_task.strftime("%Y-%m-%d"),@group.task_name])
|
||||
%td= I18n.l next_date, :format => "%a, %d.%m.%Y"
|
||||
- if task = @group.tasks.find(:first, :conditions => {:due_date => next_date, :weekly => true})
|
||||
- unless task.users.empty?
|
||||
- owner = Array.new
|
||||
- task.assignments.each do |ass|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue