Permalink
Browse files

Fix: Clarify error message when dependency is broken.

In some cases the end of a task A that is a dependency of task B is
after the start date or at least the gap does not fit. The error
message for this case is not more descriptive.
  • Loading branch information...
1 parent 4ff38b7 commit 8c208eec94b8de1fc995c16f12bc2040ac722857 @scrapper scrapper committed Jun 23, 2013
@@ -506,34 +506,21 @@ def postScheduleCheck
task = dependency.task
limit = task[dependency.onEnd ? 'end' : 'start', @scenarioIdx]
next if limit.nil?
- if @start < limit
+ if @start < limit ||
+ (dependency.gapDuration > 0 &&
+ limit + dependency.gapDuration > @start) ||
+ (dependency.gapLength > 0 &&
+ calcLength(limit, @start) < dependency.gapLength)
error('task_pred_before',
- "Task #{@property.fullId} (#{@start}) must start after " +
+ "Task #{@property.fullId} (#{@start}) must start " +
+ (dependency.gapDuration > 0 ?
+ "#{dependency.gapDuration / (60 * 60 * 24)} days " :
+ (dependency.gapLength > 0 ?
+ "#{@project.slotsToDays(dependency.gapLength)} " +
+ "working days " : '')) +
+ "after " +
"#{dependency.onEnd ? 'end' : 'start'} (#{limit}) of task " +
- "#{task.fullId}.")
- end
- if dependency.gapDuration > 0
- if limit + dependency.gapDuration > @start
- error('task_pred_before_gd',
- "Task #{@property.fullId} must start " +
- "#{dependency.gapDuration / (60 * 60 * 24)} days after " +
- "#{dependency.onEnd ? 'end' : 'start'} of task " +
- "#{task.fullId}. TaskJuggler cannot enforce this condition " +
- "because the task is scheduled ALAP (finish-to-start) or " +
- "has a fixed #{dependency.onEnd ? 'end' : 'start'} date.")
- end
- end
- if dependency.gapLength > 0
- if calcLength(limit, @start) < dependency.gapLength
- error('task_pred_before_gl',
- "Task #{@property.fullId} must start " +
- "#{@project.slotsToDays(dependency.gapLength)} " +
- "working days after " +
- "#{dependency.onEnd ? 'end' : 'start'} of task " +
- "#{task.fullId}. TaskJuggler cannot enforce this condition " +
- "because the task is scheduled ALAP (finish-to-start) or " +
- "has a fixed #{dependency.onEnd ? 'end' : 'start'} date.")
- end
+ "#{task.fullId}. This condition could not be met.")
end
end
@@ -542,34 +529,21 @@ def postScheduleCheck
task = dependency.task
limit = task[dependency.onEnd ? 'end' : 'start', @scenarioIdx]
next if limit.nil?
- if limit < @end
+ if limit < @end ||
+ (dependency.gapDuration > 0 &&
+ limit - dependency.gapDuration < @end) ||
+ (dependency.gapLength > 0 &&
+ calcLength(@end, limit) < dependency.gapLength)
error('task_succ_after',
- "Task #{@property.fullId} (#{@end}) must end before " +
+ "Task #{@property.fullId} (#{@end}) must end " +
+ (dependency.gapDuration > 0 ?
+ "#{dependency.gapDuration / (60 * 60 * 24)} days " :
+ (dependency.gapLength > 0 ?
+ "#{@project.slotsToDays(dependency.gapLength)} " +
+ "working days " : '')) +
+ "before " +
"#{dependency.onEnd ? 'end' : 'start'} (#{limit}) of task " +
- "#{task.fullId}.")
- end
- if dependency.gapDuration > 0
- if limit - dependency.gapDuration < @end
- error('task_succ_after_gd',
- "Task #{@property.fullId} must end " +
- "#{dependency.gapDuration / (60 * 60 * 24)} days before " +
- "#{dependency.onEnd ? 'end' : 'start'} of task " +
- "#{task.fullId}. TaskJuggler cannot enforce this condition " +
- "because the task is scheduled ASAP (start-to-finish) or " +
- "has a fixed #{dependency.onEnd ? 'end' : 'start'} date.")
- end
- end
- if dependency.gapLength > 0
- if calcLength(@end, limit) < dependency.gapLength
- error('task_succ_after_gl',
- "Task #{@property.fullId} must end " +
- "#{@project.slotsToDays(dependency.gapLength)} " +
- "working days before " +
- "#{dependency.onEnd ? 'end' : 'start'} of task " +
- "#{task.fullId}. TaskJuggler cannot enforce this condition " +
- "because the task is scheduled ASAP (start-to-finish) or " +
- "has a fixed #{dependency.onEnd ? 'end' : 'start'} date.")
- end
+ "#{task.fullId}. This condition could not be met.")
end
end
@@ -3,7 +3,7 @@ project "Test" 2010-07-12 +1m
task t1 "T1" {
duration 1w
}
-# MARK: error 7 task_pred_before_gl
+# MARK: error 7 task_pred_before
task t2 "T2" {
depends !t1 { gaplength 3d }
duration 6d
@@ -3,7 +3,7 @@ project "Test" 2010-07-12 +1m
task t1 "T1" {
duration 1w
}
-# MARK: error 7 task_pred_before_gd
+# MARK: error 7 task_pred_before
task t2 "T2" {
depends !t1 { gapduration 3d }
duration 6d
@@ -4,7 +4,7 @@ task t1 "T1" {
duration 1w
end 2010-07-26
}
-# MARK: error 8 task_succ_after_gl
+# MARK: error 8 task_succ_after
task t2 "T2" {
precedes !t1 { gaplength 3d }
duration 6d
@@ -4,7 +4,7 @@ task t1 "T1" {
duration 1w
end 2010-07-26
}
-# MARK: error 8 task_succ_after_gd
+# MARK: error 8 task_succ_after
task t2 "T2" {
precedes !t1 { gapduration 3d }
duration 6d

0 comments on commit 8c208ee

Please sign in to comment.