tags:

views:

36

answers:

1

Actually i am trying to use dotproject to build my own small application.
I am stuck up at a point where dotproject displays all the tasks related to a particular project .It queries the database for this firing the sql below

 $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
    $q->addQuery('com.company_name AS company_name, com_internal.company_name'
        . ' AS company_name_internal' 
        . ", CONCAT_WS(', ',contact_last_name,contact_first_name) user_name" 
        . ', projects.*, SUM(t1.task_duration * t1.task_percent_complete' 
        ." * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" 
        ." / SUM(t1.task_duration * IF(t1.task_duration_type = 24, {$working_hours}," 
        . ' t1.task_duration_type)) AS project_percent_complete');

    $q->addWhere('t1.task_id = t1.task_parent');
$q->addWhere('project_id = ' . $project_id);
$q->addGroup('project_id');

I am not able to understand the sql properly.Actually, this sql retrieves all the tasks associated with a project.But in my project i want only that tasks whose duration has completed.

How do i change the sql to make that happen?

A: 

You can simplify most of that and just look at the task_percent_complete field on the tasks table. If that's 100%, then the task is complete.

If you're looking to build an app on top of dotproject, I'd suggest that you check out web2project instead. We forked from dotproject about two years ago and have cleaned up and improved the system significantly. Feel free to drop me a note if you have any questions.

CaseySoftware