diff --git a/extension/lite/my/ext/model/lite.php b/extension/lite/my/ext/model/lite.php index bb9cfa902e..8825549c50 100644 --- a/extension/lite/my/ext/model/lite.php +++ b/extension/lite/my/ext/model/lite.php @@ -32,7 +32,9 @@ public function getReviewingStories(string $orderBy = 'id_desc', bool $checkExis return !empty($stories); } - $actions = $this->dao->select('objectID,`date`')->from(TABLE_ACTION)->where('objectType')->eq('story')->andWhere('objectID')->in(array_keys($stories))->andWhere('action')->eq('submitreview')->orderBy('`date`')->fetchPairs(); - foreach($actions as $storyID => $date) $stories[$storyID]->time = $date; + $actions = $this->dao->select('objectID,`date`')->from(TABLE_ACTION)->where('objectType')->eq('story')->andWhere('objectID')->in(array_keys($stories))->andWhere('action')->eq('submitreview')->orderBy('`date`')->fetchPairs(); + $projects = $this->dao->select('story,project')->from(TABLE_PROJECTSTORY)->where('story')->in(array_keys($stories))->fetchPairs(); + foreach($projects as $storyID => $projectID) $stories[$storyID]->project = $projectID; + foreach($actions as $storyID => $date) $stories[$storyID]->time = $date; return array_values($stories); } diff --git a/module/my/model.php b/module/my/model.php index 838b41eeab..33ebc027cd 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -1083,7 +1083,7 @@ class myModel extends model public function getReviewingStories(string $orderBy = 'id_desc', bool $checkExists = false, $type = 'story'): array|bool { $this->app->loadLang($type); - $stories = $this->dao->select("t1.id, t1.title, 'story' AS type, t1.openedDate AS time, t1.status, t1.product, 0 AS project, t1.parent")->from(TABLE_STORY)->alias('t1') + $stories = $this->dao->select("t1.id, t1.title, 'story' AS type, t1.type AS storyType, t1.openedDate AS time, t1.status, t1.product, 0 AS project, t1.parent")->from(TABLE_STORY)->alias('t1') ->leftJoin(TABLE_STORYREVIEW)->alias('t2')->on('t1.id = t2.story and t1.version = t2.version') ->where('t1.deleted')->eq(0) ->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi()