perf: 今天任务、我的任务

This commit is contained in:
kuaifan
2021-12-22 22:39:08 +08:00
parent 6d9237c399
commit 6c34f083e3
4 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ class Project extends AbstractModel
$this->appendattrs['task_complete'] = $builder->whereNotNull('complete_at')->count();
$this->appendattrs['task_percent'] = $this->appendattrs['task_num'] ? intval($this->appendattrs['task_complete'] / $this->appendattrs['task_num'] * 100) : 0;
//
$builder = ProjectTask::whereProjectId($this->id)->whereParentId(0)->authData(User::userid())->whereNull('archived_at');
$builder = ProjectTask::whereProjectId($this->id)->whereParentId(0)->authData(User::userid(), true)->whereNull('archived_at');
$this->appendattrs['task_my_num'] = $builder->count();
$this->appendattrs['task_my_complete'] = $builder->whereNotNull('complete_at')->count();
$this->appendattrs['task_my_percent'] = $this->appendattrs['task_my_num'] ? intval($this->appendattrs['task_my_complete'] / $this->appendattrs['task_my_num'] * 100) : 0;