Extract detailed splits from task
RafaelN0bre opened this issue · comments
Hi, I am currently struggling with an issue whose main goal is to extract task splits with detailed start and finish information. In my .mpp file, some tasks are split as shown below:
I have attempted to use getSplits from the Task class, but it doesn't return the expected results, that is the dates when the task is being executed.
Additionally, I would like to know if there is any way to reschedule tasks based on a provided status_date or if this functionality is not within the scope of the library.
Thanks.
More detailed post on StackOverFlow
Thanks for your note. Would you be able to provide a sample MPP file and some notes illustrating what you are seeing from MPXJ and what you are expecting to see?
Additionally, I would like to know if there is any way to reschedule tasks based on a provided status_date or if this functionality is not within the scope of the library.
This is not something which MPXJ can do presently, although I am planning to implement this type of functionality in the future.
Thanks for the quick reply
Description
Here i sending an mpp with 2 task that are splitted. 6 and 7, as shown below:
I expected to get in getSplits, the LocalDateTimeRanges corresponding to the filled bar, where the task will be actually executed. But as shown below, i get None splits for task 6 and five for task 7 (which do not match)
Assets
Code
import jpype
try:
jpype.startJVM()
except:
pass
import mpxj
from java.io import FileInputStream
from net.sf.mpxj.reader import UniversalProjectReader
mpp_file_path = r"test_splits.mpp"
input_stream = FileInputStream(mpp_file_path)
project = UniversalProjectReader().read(input_stream)
def print_task(task):
print("Task ID - " + str(task.getID()))
print("Name - " + str(task.getName()))
print("Baseline Start 1 - " + str(task.getBaselineStart(1)))
print("Actual Start - " + str(task.getActualStart()))
print("Baseline End 1 - " + str(task.getBaselineFinish(1)))
print("Actual End - " + str(task.getActualFinish()))
print("Baseline Duration 1 - " + str(task.getBaselineDuration(1)))
print("Actual Duration - " + str(task.getActualDuration()))
print("Splits :")
print(task.getSplits())
print("\n")
task = project.getTaskByID(jpype.JClass("java.lang.Integer")(6))
print_task(task)
task = project.getTaskByID(jpype.JClass("java.lang.Integer")(7))
print_task(task)
Enviroment
- Windows 11
- Python 3.10.8
- java 11.0.19 2023-04-18 LTS
- Java(TM) SE Runtime Environment 18.9 (build 11.0.19+9-LTS-224)
- Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.19+9-LTS-224, mixed mode)
- mpxj 12.5.0
- JPype1==1.4.1
- mpxj==12.5.0
Thanks for the support
Thanks for the detailed information, I will look at this as soon as I can.
@joniles, any update?
I would appreciate some clarification to determine if the issue lies with the library or if I am misunderstanding the object structure. If the problem is related to the getSplits()
method, could you please guide me to the specific part of the code where the splits are translated? I'm interested in exploring a potential correction and, if successful, submitting a pull request.
I understand I might be a bit persistent, and I apologize for that. Currently, I am working on a project involving the translation and processing of data from MPP projects, and addressing this issue is crucial. I would like to contribute to the improvement of the library as well.
Thank you for your time and assistance.
Apologies I'm busy with other work, I will look at this issue as soon as I can, but it is likely to be next week before I have that opportunity.
The data returned by the getSplits
method is in the form [working time][non working time][working time]
, so a task with three splits will have five entries in the list returned by getSplits
. I believe I have fixed the issue you noted which means that task 6 in your sample file doesn't return anything from getSplits
. This fix will be available shortly in the next MPXJ release.