Commit 410fa2e3 authored by wangzhengwen's avatar wangzhengwen

课程

parent 4f6b7a9a
...@@ -282,14 +282,21 @@ class Index extends BaseController ...@@ -282,14 +282,21 @@ class Index extends BaseController
$result = []; $result = [];
foreach ($works as $work) { foreach ($works as $work) {
$workId = $work['id']; $workId = $work['id'];
// 如果 submitted=0 或者 submitted=pending,跳过这次循环
if (($stats[$workId]['submitted'] ?? 0) == 0 ||
($stats[$workId]['submitted'] ?? 0) == ($stats[$workId]['pending'] ?? 0)) {
continue;
}
$result[] = [ $result[] = [
'work_id' => $workId, 'work_id' => $workId,
'title' => $work['title'], 'title' => $work['title'],
'course_id' => $work['course_id'], 'course_id' => $work['course_id'],
'submitted_count' => $stats[$workId]['submitted'] ?? 0, 'submitted_count' => $stats[$workId]['submitted'] ?? 0,
'pending_count' => $stats[$workId]['pending'] ?? 0, 'pending_count' => $stats[$workId]['pending'] ?? 0,
'course_name'=>$work['course_name'], 'course_name' => $work['course_name'],
'course_category'=>$work['course_category'] 'course_category' => $work['course_category']
]; ];
} }
return $this->returnMsg('success', 1,$result); return $this->returnMsg('success', 1,$result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment