Commit 06f50cfb authored by wangzhengwen's avatar wangzhengwen

课程

parent 410fa2e3
...@@ -282,10 +282,11 @@ class Index extends BaseController ...@@ -282,10 +282,11 @@ class Index extends BaseController
$result = []; $result = [];
foreach ($works as $work) { foreach ($works as $work) {
$workId = $work['id']; $workId = $work['id'];
$submitted = $stats[$workId]['submitted'] ?? 0;
$pending = $stats[$workId]['pending'] ?? 0;
// 如果 submitted=0 或者 submitted=pending,跳过这次循环 // 如果 pending=0 或 submitted=0 或 submitted=pending,跳过
if (($stats[$workId]['submitted'] ?? 0) == 0 || if ($pending == 0 || $submitted == 0 || $submitted == $pending) {
($stats[$workId]['submitted'] ?? 0) == ($stats[$workId]['pending'] ?? 0)) {
continue; continue;
} }
...@@ -293,8 +294,8 @@ class Index extends BaseController ...@@ -293,8 +294,8 @@ class Index extends BaseController
'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' => $submitted,
'pending_count' => $stats[$workId]['pending'] ?? 0, 'pending_count' => $pending,
'course_name' => $work['course_name'], 'course_name' => $work['course_name'],
'course_category' => $work['course_category'] 'course_category' => $work['course_category']
]; ];
......
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