generated from liutk/owl-admin-base
Fix
parent
0a4aec1690
commit
f5442d9729
|
|
@ -135,12 +135,13 @@ class TaskService extends BaseService
|
|||
'task_status' => TaskStatus::Pending,
|
||||
]);
|
||||
|
||||
if ($taskable->isSuccess()) {
|
||||
$task->task_status = TaskStatus::Success;
|
||||
$task->completed_at = now();
|
||||
}
|
||||
|
||||
$taskable->task()->save($task);
|
||||
$taskable->task()->create([
|
||||
'plan_id' => $plan->id,
|
||||
'name' => '清洁卫生',
|
||||
'start_at' => $startAt,
|
||||
'end_at' => $endAt,
|
||||
'task_status' => TaskStatus::Pending,
|
||||
]);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class TaskPerformance extends Model
|
|||
*/
|
||||
public function isSuccess(): bool
|
||||
{
|
||||
return $this->task_status === TaskPerformanceStatus::Success;
|
||||
return bccomp($this->actual_performance, $this->expected_performance, 2) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -56,7 +56,7 @@ class TaskPerformance extends Model
|
|||
{
|
||||
return Attribute::make(
|
||||
get: function (mixed $value, array $attributes) {
|
||||
if (bccomp($attributes['actual_performance'], $attributes['expected_performance'], 2) >= 0) {
|
||||
if ($this->isSuccess()) {
|
||||
return TaskPerformanceStatus::Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue