Work values incorrect when changing duration on semi-complete task with non-Flat WorkContour

There seems to be an issue with the way that Work, RemainingWork is calculated for a Task when the assignment WorkContour is not flat and there is greater than zero PercentComplete.

The behavior is different than what occurs within Microsoft Project.
Steps in MS Project:

  • Create Task 1, duration 10 days. Assign Resource 1. Set WorkContour to Back Loaded.
  • Create Task 2, duration 10 days. Assign Resource 2. Set WorkContour to Back Loaded.
  • Set % Complete on Task 2 to 25%. Actual work changes to 3 hours.
  • Change Task 1 duration to 20 days. Remaining work changes to 96 hours.
  • Change Task 2 duration to 20 days. Remaining work changes to 125 hours.

Performing the same actions using the sample project. The values for both Task 1 and Task 2 Work is 96 hours.

            string fileName = @"C:\Example_Backloaded_Aspose.MPP";

        Project m_Project = new Project(fileName);

        //Set Calculation Mode to Automatic
        m_Project.CalculationMode = Aspose.Tasks.CalculationMode.Automatic;

        foreach (Aspose.Tasks.Task m_Task_Source in m_Project.RootTask.SelectAllChildTasks())
        {
            if (!m_Task_Source.Get(Tsk.IsSummary))
            {
                m_Task_Source.Set(Tsk.Duration, m_Task_Source.Get(Tsk.Duration).Add(10));

                Console.WriteLine("Before - ID: {0} Name: {1}  Duration: {2}  Type: {3}  Work: {4}  ActualWork: {5} RemainingWork: {6} Cost: {7} ActualCost: {8} %Complete: {9}",
                m_Task_Source.Get(Tsk.Uid),
                m_Task_Source.Get(Tsk.Name),
                m_Task_Source.Get(Tsk.Duration),
                m_Task_Source.Get(Tsk.Type),
                m_Task_Source.Get(Tsk.Work),
                m_Task_Source.Get(Tsk.ActualWork),
                m_Task_Source.Get(Tsk.RemainingWork),
                m_Task_Source.Get(Tsk.Cost),
                m_Task_Source.Get(Tsk.ActualCost),
                m_Task_Source.Get(Tsk.PercentComplete)
                );
            }
        }

image.png (12.2 KB)
Example_BackLoaded.zip (59.5 KB)

This can be seen in the attached sample mpp file.

Is this a bug, or am I doing something wrong?

@leglandpalisade,
could you provide a sample code you used to make “Example_BackLoaded_Aspose.mpp” ?

@vasiliysinitsyn,
It was actually created using Microsoft Project. Could that be causing the problem?

@leglandpalisade,
No, I thought that you’ve created “Example_BackLoaded_Aspose.mpp” from the scratch using another code snippet.

We need some time to compare MS Project’s and Aspose.Tasks’ behavior.

@leglandpalisade,
we need to fix our recalculation logic for the described case so that it produces the same result as MS Project does. A ticket with ID ** TASKSNET-10523** has been created to resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.