diff --git a/src/core/jupiter/core/domain/inbox_tasks/inbox_task.py b/src/core/jupiter/core/domain/inbox_tasks/inbox_task.py
index d1daca29..da22f9de 100644
--- a/src/core/jupiter/core/domain/inbox_tasks/inbox_task.py
+++ b/src/core/jupiter/core/domain/inbox_tasks/inbox_task.py
@@ -1111,6 +1111,7 @@ async def find_completed_in_range(
allow_archived: bool,
filter_start_completed_date: ADate,
filter_end_completed_date: ADate,
+ filter_include_sources: Iterable[InboxTaskSource],
filter_exclude_ref_ids: Iterable[EntityId] | None = None,
) -> list[InboxTask]:
"""Find all completed inbox tasks in a time range."""
diff --git a/src/core/jupiter/core/repository/sqlite/domain/inbox_tasks.py b/src/core/jupiter/core/repository/sqlite/domain/inbox_tasks.py
index 401fda14..b92969c7 100644
--- a/src/core/jupiter/core/repository/sqlite/domain/inbox_tasks.py
+++ b/src/core/jupiter/core/repository/sqlite/domain/inbox_tasks.py
@@ -136,6 +136,7 @@ async def find_completed_in_range(
allow_archived: bool,
filter_start_completed_date: ADate,
filter_end_completed_date: ADate,
+ filter_include_sources: Iterable[InboxTaskSource],
filter_exclude_ref_ids: Iterable[EntityId] | None = None,
) -> list[InboxTask]:
"""find all completed inbox tasks in a time range."""
@@ -156,6 +157,7 @@ async def find_completed_in_range(
s.value for s in InboxTaskStatus.all_completed_statuses()
)
)
+ .where(self._table.c.source.in_(s.value for s in filter_include_sources))
.where(self._table.c.completed_time.is_not(None))
.where(self._table.c.completed_time >= start_completed_time.the_ts)
.where(self._table.c.completed_time <= end_completed_time.the_ts)
diff --git a/src/core/jupiter/core/use_cases/time_plans/activity/load.py b/src/core/jupiter/core/use_cases/time_plans/activity/load.py
index fe37af00..990bb385 100644
--- a/src/core/jupiter/core/use_cases/time_plans/activity/load.py
+++ b/src/core/jupiter/core/use_cases/time_plans/activity/load.py
@@ -60,6 +60,7 @@ async def _perform_transactional_read(
TimePlanActivity.target_inbox_task,
TimePlanActivity.target_big_plan,
allow_archived=args.allow_archived,
+ allow_subentity_archived=args.allow_archived,
)
if not workspace.is_feature_available(WorkspaceFeature.BIG_PLANS):
diff --git a/src/core/jupiter/core/use_cases/time_plans/load.py b/src/core/jupiter/core/use_cases/time_plans/load.py
index 52f81118..a6f3a0d1 100644
--- a/src/core/jupiter/core/use_cases/time_plans/load.py
+++ b/src/core/jupiter/core/use_cases/time_plans/load.py
@@ -108,6 +108,15 @@ async def _perform_transactional_read(
completed_nontarget_inbox_tasks = None
if args.include_completed_nontarget and target_inbox_tasks is not None:
+
+ # The rule here should be:
+ # If this is a inbox task or big plan include it always
+ # If this is a generated one, then:
+ # If the recurring_task_period is strictly higher than the time plan is we include it
+ # If the recurring_task_period is equal or lower than the time plan one we skip it
+ # expressed as: (it.source in (user, big-plan)) or (it.period in (*all_higher_periods)
+ # But this is hard to express cause inbox_tasks don't yet remember the period
+ # of their source entity. Inference from the timeline is hard in SQL, etc.
completed_nontarget_inbox_tasks = await uow.get(
InboxTaskRepository
).find_completed_in_range(
@@ -115,6 +124,7 @@ async def _perform_transactional_read(
allow_archived=True,
filter_start_completed_date=schedule.first_day,
filter_end_completed_date=schedule.end_day,
+ filter_include_sources=[InboxTaskSource.USER, InboxTaskSource.BIG_PLAN],
filter_exclude_ref_ids=[it.ref_id for it in target_inbox_tasks],
)
@@ -153,9 +163,9 @@ async def _perform_transactional_read(
target_inbox_tasks_by_ref_id = {
it.ref_id: it for it in cast(list[InboxTask], target_inbox_tasks)
}
- target_big_plans_by_ref_id = {
- bp.ref_id: bp for bp in cast(list[BigPlan], target_big_plans)
- }
+ target_big_plans_by_ref_id = (
+ {bp.ref_id: bp for bp in target_big_plans} if target_big_plans else {}
+ )
activities_by_big_plan_ref_id: defaultdict[
EntityId, list[EntityId]
] = defaultdict(list)
@@ -169,7 +179,6 @@ async def _perform_transactional_read(
if activity.kind == TimePlanActivityKind.FINISH:
activity_doneness[activity.ref_id] = inbox_task.is_completed
elif activity.kind == TimePlanActivityKind.MAKE_PROGRESS:
- print(time_plan.start_date, time_plan.end_date, inbox_task)
modified_in_time_plan = (
inbox_task.is_working_or_more
and time_plan.start_date.to_timestamp_at_start_of_day()
diff --git a/src/webui/app/components/infra/layout/nesting-aware-block.tsx b/src/webui/app/components/infra/layout/nesting-aware-block.tsx
index 8c3f96a7..16b12fe6 100644
--- a/src/webui/app/components/infra/layout/nesting-aware-block.tsx
+++ b/src/webui/app/components/infra/layout/nesting-aware-block.tsx
@@ -1,5 +1,4 @@
import { Stack } from "@mui/system";
-import { Form } from "@remix-run/react";
import type { PropsWithChildren } from "react";
import { useBigScreen } from "~/rendering/use-big-screen";
@@ -22,14 +21,12 @@ export function NestingAwareBlock(
}
return (
-