Remove a period's days along with the period
Deleting a period left every day it had funded behind. The link from a day back to its period was set to null the instant the period was deleted, so the days became untraceable before anything could clean them up, and the next recalculation had no way to know they no longer belonged to anything. Undo had the same fault for the same reason: the period went, the days stayed, and a reload showed them still there. The days are now removed with the period, before the link can be broken. A day pinned by hand goes too — pinning keeps the planner from quietly retyping a day, not from being deleted when you delete the period it belongs to, which is already how an unplanned band behaves.
This commit is contained in:
@@ -172,3 +172,10 @@ class SQLitePlannedLeaveRepository(PlannedLeaveRepository):
|
||||
)
|
||||
row = await cursor.fetchone()
|
||||
return int(row[0]) if row else 0
|
||||
|
||||
async def delete_by_wish(self, wish_id: UUID) -> int:
|
||||
cursor = await self._conn.execute(
|
||||
"DELETE FROM planned_leave_day WHERE wish_id = ?", (str(wish_id),)
|
||||
)
|
||||
await self._conn.commit()
|
||||
return cursor.rowcount
|
||||
|
||||
Reference in New Issue
Block a user