[Tasks] Extend IsTaskCompleted to also be aware of shared task completion (#4714)

* [Tasks] Extend IsTaskCompleted to also be aware of shared task completion

* Fix my stupidity

* Update client.h
This commit is contained in:
Chris Miles
2025-02-24 16:31:35 -06:00
committed by GitHub
parent 80e8634a48
commit fa2ab11676
4 changed files with 41 additions and 4 deletions
+11 -1
View File
@@ -952,6 +952,8 @@ int ClientTaskState::IncrementDoneCount(
client->CancelTask(task_index, task_data->type);
}
client->LoadClientSharedCompletedTasks();
}
}
else {
@@ -1561,7 +1563,7 @@ int ClientTaskState::TaskTimeLeft(int task_id)
return -1;
}
bool ClientTaskState::IsTaskCompleted(int task_id)
bool ClientTaskState::IsTaskCompleted(int task_id, Client *c)
{
if (!RuleB(TaskSystem, RecordCompletedTasks)) {
return false;
@@ -1574,6 +1576,14 @@ bool ClientTaskState::IsTaskCompleted(int task_id)
}
}
if (c) {
for (auto &e: c->GetCompletedSharedTasks()) {
if (e == task_id) {
return true;
}
}
}
return false;
}