Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test budget-with-subgoal #433

Merged
merged 31 commits into from
Feb 17, 2024
Merged

Conversation

tijlleenders
Copy link
Owner

@tijlleenders tijlleenders commented Jan 23, 2024

Sorry for the messy commit history.

I didn't want to loose out on the improvements from the other PRs waiting for review - and then I tried rebasing for the first time :) This PR's commits start at fix unwrap bug - a commit that wasn't necessary and is overturned later... Still haven't figured out how to clean that up so I get a commit history that reads like a story...

In terms of the strategies outlined below, the simple Goals get scheduled first anyway - so there was no special change needed for current test cases. Just filtering the Hours based on the Budget and updating the Budget when placing the simple Goal.

Basically what I did to fix this issue:

  • Treat a Goal that has children as valid for generating Activities from (don't skip if children present, like before)
  • Updated the Budget struct so it also stores the appropriate Filters. This can then be used in generating the calendar_overlay for the simple Goal activities - by checking if the Simple Goal is part of any Budget - and if it is - use the Filters upon initial construction of its overlay. We don't want that to happen more than once. It's a static constraint - not a dynamic one like Budgets.
  • Updated the dynamic constraint in the placer loop ( activity.update_overlay_with(&calendar.budgets); ) to also update Simple Goal overlays when the Simple Goal is part of a Budget
  • Updated placer to update the Budget if a Simple Goal is part of a Budget

=============================
Original PR/issue description:
Test where someone has a workbudget of 40h on weekdays. Below that, as a subgoal, we add a 1h 'Plan my work week'.

Since the goal is more specific than the generic budget - it should be planned first - and also reduce the budget by one hour, as it counts as work (since it's a subgoal of work).

Technically, I see a few ways of approaching this:

  1. make an activity for 'Plan my work week' - possibly with new type and somehow integrate that in the scheduling so that it's always earlier than the budget it is part of... sounds complicated?
  2. Or if we place it in the same Vec<Activity> as the budget - but at the beginning of the Vec - it will get scheduled first - as it will always have the same flexibility as the other budget Activity hours?
  3. Keep the 'Plan my work week' on a separate list, and replace/switch out the first Task hour of 'Work' budget Tasks (after they have been scheduled normally taking 40h of the week) with the simple goal title.

@tijlleenders
Copy link
Owner Author

@thinkrapido @kobe-reygel
This is a failing test case. I've not made a separate issue for it - but have added the PR to the project board parking lot - where it appears just like an issue - and can be self-assigned if you'd like to work on solving this.

@tijlleenders tijlleenders self-assigned this Feb 4, 2024
Copy link
Collaborator

@thinkrapido thinkrapido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly resolve some code duplications.

src/models/activity.rs Outdated Show resolved Hide resolved
src/models/activity.rs Show resolved Hide resolved
src/models/calendar.rs Show resolved Hide resolved
src/models/calendar.rs Show resolved Hide resolved
@Tushar-4781 Tushar-4781 merged commit 117c82e into main Feb 17, 2024
3 checks passed
@tijlleenders tijlleenders deleted the tijl/-/add-budget-with-subgoal-test branch February 17, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants