-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Description
When using TaskJuggler 3.8.1 with Ruby 3.4.0 on a project with specific resource configurations, including the chart column in task reports or using certain resource-related columns causes a fatal error: undefined method '[]' for nil in ResourceScenario.rb.
Steps to Reproduce
- Install TaskJuggler 3.8.1 with Ruby 3.4.0
- Create a project file with a hierarchy of tasks and resources
- Add dependencies between tasks
- Add a taskreport that includes the
chartcolumn or a resourcereport with calendar views - Run the project with
tj3 --output-dir output_dir project.tjp
Reproducible Example
project migration "Project" "1.0" 2024-07-15 - 2024-08-15 {
now 2024-07-15
timeformat "%Y-%m-%d"
numberformat "-" "" "." "," 2
workinghours mon - fri 8:00 - 12:00, 13:00 - 17:00
}
# Resource with detailed configuration
resource dev "Developer" {
# Add properties that might trigger the issue
}
# Task hierarchy with dependencies
task project_root "Project Root" {
task phase1 "Phase 1" {
task p1s1 "Task 1.1" {
effort 1d
allocate dev
}
task p1s2 "Task 1.2" {
depends !p1s1
effort 2d
allocate dev
}
}
task phase2 "Phase 2" {
depends !phase1
task p2s1 "Task 2.1" {
effort 1d
allocate dev
}
}
}
# Report that causes the issue
taskreport "tasks" {
headline "Task Plan"
formats html
columns name, start, end, chart # This column causes the error
hideresource 0
}
# Resource report that may also cause issues
resourcereport "resources" {
headline "Resource Allocation"
formats html
columns name, weekly # Calendar view causes issues
loadunit days
hidetask 0
}
Error Message
Fatal: undefined method '[]' for nil
C:/Users/username/.local/share/gem/ruby/3.4.0/gems/taskjuggler-3.8.1/lib/taskjuggler/ResourceScenario.rb:499:in 'TaskJuggler::ResourceScenario#treeSum'
C:/Users/username/.local/share/gem/ruby/3.4.0/gems/taskjuggler-3.8.1/lib/taskjuggler/ResourceScenario.rb:587:in 'TaskJuggler::ResourceScenario#getEffectiveFreeWork'
...
Environment
- TaskJuggler version: 3.8.1
- Ruby version: 3.4.0
- OS: Windows 10
Workaround
- Remove the
chartcolumn from taskreport:
taskreport "tasks" {
formats html
columns name, start, end, effort, resources
}
- Remove calendar columns like
weeklyfrom resourcereport:
resourcereport "resources" {
formats html
columns name, start, end, effort
}
Additional Information
The error appears to be related to how ResourceScenario.rb processes resource data when calculating the Gantt chart or calendar views. The error only occurs with specific configurations and may be related to compatibility issues with Ruby 3.4.0.
The specific line that fails is in ResourceScenario.rb:499:
cacheTag = "#{self.class}.#{caller[0][/`.*'/][1..-2]}"This suggests a problem with regex pattern matching on caller information, which has changed in newer Ruby versions.
Metadata
Metadata
Assignees
Labels
No labels