Skip to content

Commit

Permalink
prevent subtracting child duration if None
Browse files Browse the repository at this point in the history
  • Loading branch information
Tijl Leenders committed Mar 26, 2024
1 parent 737b03d commit 89fd07b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/services/activity_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ pub(crate) fn get_base_activities(calendar: &Calendar, goals: &[Goal]) -> Vec<Ac
.filter(|child| goal.children.clone().unwrap().contains(&child.id))
.collect();
for c in children {
activity.min_block_size -= c.min_duration.unwrap();
activity.max_block_size -= c.min_duration.unwrap();
activity.total_duration -= c.min_duration.unwrap();
activity.duration_left -= c.min_duration.unwrap();
if let Some(child_duration) = c.min_duration {
activity.min_block_size -= child_duration;
activity.max_block_size -= child_duration;
activity.total_duration -= child_duration;
activity.duration_left -= child_duration;
}
}
}
activities.append(&mut temp_activities);
Expand Down

0 comments on commit 89fd07b

Please sign in to comment.