Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread


By: Gerry Bragg
RE: Perform date calculation on child on Upda [ reply ]  
2007-09-27 09:09
Did you get resolution on this? If so let us know what the issue was. Thanks!

By: nicole kelly
Perform date calculation on child on Update [ reply ]  
2007-08-29 19:22
Hi - I love the sublist plugin - I have a project management system that has projects (parent) and tasks (child). When I update the tasks (from within the project view via the sublist plugin), I'd like to perform a date calculation on two of the task fields that are entered into the database.

When I CREATE the project and subsequent tasks, the task start and end date calculations are as follows:

@projecttemplate.templatetasks.each do |t| #loop through tasks of the project template
@newtasks = @newproject.tasks.create(t.attributes) #build tasks for the new project from the templatetask attributes
@newtasks.statusID = 1
@newtasks.dateStart = @newproject.dateTargetEnd - @newtasks.leadTime
@newtasks.dateTargetEnd = @newtasks.dateStart + @newtasks.duration!

I'm wondering how I add these calculations to the project update view (seen below)...
def update
@project = Project.find(params[:id])
success = true
success &&= initialize_tasks
success &&=
if success
flash[:notice] = 'Project successfully updated.'
redirect_to :action => 'show', :id => @project
render_action 'edit'

Any help greatly appreciated!