prevented deletion of tasks with subtasks

This commit is contained in:
2025-07-30 23:16:24 +02:00
parent c5f7fd8ec0
commit 99fa2ab1ce
2 changed files with 7 additions and 2 deletions

View File

@@ -112,6 +112,11 @@ CREATE TABLE IF NOT EXISTS {0} (
@Override @Override
public void delete(Task task) throws UmbrellaException { public void delete(Task task) throws UmbrellaException {
try { try {
var rs = select("count(*)").from(TABLE_TASKS).where(PARENT_TASK_ID,equal(task.id())).exec(db);
long count = 0;
if (rs.next()) count = rs.getLong(1);
rs.close();
if (count>0) throw new UmbrellaException("Task \"{0}\" has child tasks and thus cannot be deleted!",task.name());
Query.delete().from(TABLE_TASKS).where(ID,equal(task.id())).execute(db); Query.delete().from(TABLE_TASKS).where(ID,equal(task.id())).execute(db);
Query.delete().from(TABLE_TASKS_USERS).where(TASK_ID,equal(task.id())).execute(db); Query.delete().from(TABLE_TASKS_USERS).where(TASK_ID,equal(task.id())).execute(db);
} catch (SQLException e) { } catch (SQLException e) {

View File

@@ -132,8 +132,8 @@ li.task > button{
display: none; display: none;
} }
li.task:hover{ li.task{
padding: 15px 0; padding: 5px 0;
} }
li.task:hover > button{ li.task:hover > button{