Wrong ID of Tasks

When I create children tasks, generated a wrong task ID:

public static void main(String[] args) throws IOException {
	Project project = new Project();
	project.set(Prj.DURATION_FORMAT, TimeUnitType.Hour);
	
	Task rootTask = project.getRootTask();
	
	Task a = rootTask.getChildren().add("A");
	a.set(Tsk.DURATION, project.getDuration(0.5d, TimeUnitType.Day));
	
	Task b = project.getRootTask().getChildren().add("B");
	b.set(Tsk.DURATION, project.getDuration(0.5d, TimeUnitType.Day));
	
	Task c = project.getRootTask().getChildren().add("C");
	c.set(Tsk.DURATION, project.getDuration(0.5d, TimeUnitType.Day));
	
	Task a2 = a.getChildren().add("A2");
	a2.set(Tsk.DURATION, project.getDuration(0.5d, TimeUnitType.Day));
	
	printTask(a);
	printTask(a2);
	printTask(b);
	printTask(c);
}

private static void printTask(Task task) {
	System.out.println(task.get(Tsk.ID) + " | " + task.get(Tsk.NAME) + " | " + task.get(Tsk.START) + " | " + task.get(Tsk.FINISH) + " | " + task.get(Tsk.DURATION));
}

Result:

1 | A | Wed Aug 26 08:00:00 BRT 2020 | Wed Aug 26 12:00:00 BRT 2020 | 0,5 days
4 | A2 | Wed Aug 26 08:00:00 BRT 2020 | Wed Aug 26 12:00:00 BRT 2020 | 0,5 days
2 | B | Wed Aug 26 08:00:00 BRT 2020 | Wed Aug 26 12:00:00 BRT 2020 | 0,5 days
3 | C | Wed Aug 26 08:00:00 BRT 2020 | Wed Aug 26 12:00:00 BRT 2020 | 0,5 days

The A2 task should be 2.

Another error happens using project.recalculate():

	Project project = new Project();
	project.set(Prj.DURATION_FORMAT, TimeUnitType.Hour);
	
	project.setCalculationMode(CalculationMode.None);
	Task rootTask = project.getRootTask();
	
	Task a = rootTask.getChildren().add("A");
	a.set(Tsk.DURATION, project.getDuration(0.5d, TimeUnitType.Day));
	
	Task b = project.getRootTask().getChildren().add("B");
	b.set(Tsk.DURATION, project.getDuration(0.5d, TimeUnitType.Day));
	
	Task c = project.getRootTask().getChildren().add("C");
	c.set(Tsk.DURATION, project.getDuration(0.5d, TimeUnitType.Day));
	
	project.setCalculationMode(CalculationMode.Automatic);
	project.recalculate();
	
	Task d = project.getRootTask().getChildren().add("D");
	c.set(Tsk.DURATION, project.getDuration(0.5d, TimeUnitType.Day));
	
	printTask(a);
	printTask(b);
	printTask(c);
	printTask(d);

Result:

1 | A | Wed Aug 26 08:00:00 BRT 2020 | Wed Aug 26 12:00:00 BRT 2020 | 0,5 days
2 | B | Wed Aug 26 08:00:00 BRT 2020 | Wed Aug 26 12:00:00 BRT 2020 | 0,5 days
3 | C | Wed Aug 26 08:00:00 BRT 2020 | Wed Aug 26 12:00:00 BRT 2020 | 0,5 days
5 | D | Wed Aug 26 08:00:00 BRT 2020 | Wed Aug 26 17:00:00 BRT 2020 | 8 hrs

The D task should be 4.

Version:

	<dependency>
		<groupId>com.aspose</groupId>
		<artifactId>aspose-tasks</artifactId>
		<version>20.7</version>
		<classifier>jdk17</classifier>
	</dependency>

@jexperts

I have added a ticket with ID TASKSJAVA-1211 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Some news about this.

I can’t update Aspose.Tasks because of this bug.

@jexperts

i request for your patience till the time the issue gets resolved and we will share the good news with you as soon as possible.

Hi,

We buy the new licence to mantain the lib always updated.

We need this bug fixed quickly.

This ticket was opened 7 months ago.

@jexperts

We are sorry for your inconvenience. I have requested for the updates and will share the updates with you as soon as it will be fixed.

@jexperts

The issue has been marked as fixed for upcoming Aspose.Tasks for Java 21.4. We will share the notification as well once the product will be shared online.