|
|
|
|
@ -149,18 +149,21 @@ class OtherController extends CommonController
|
|
|
|
|
$start_date = CourseType::START_DATE;
|
|
|
|
|
$end_date = date('Y-m-d');
|
|
|
|
|
foreach ($courseTypes as $courseType) {
|
|
|
|
|
// 课程
|
|
|
|
|
$courses = Course::where('type', $courseType->id)->get();
|
|
|
|
|
// 已开设期数
|
|
|
|
|
$baseCoursePeriodsTotal = Course::where('type', $courseType->id)->count();
|
|
|
|
|
// 历史已开设期数
|
|
|
|
|
$historyCourse = HistoryCourse::whereHas('typeDetail', function ($query) use ($courseType) {
|
|
|
|
|
$query->where('name', 'like', '%' . $courseType->name . '%');
|
|
|
|
|
})->get();
|
|
|
|
|
// 历史课程期数
|
|
|
|
|
$courseType->history_course_periods_total = $historyCourse->count();
|
|
|
|
|
// 历史课程培养人数去重
|
|
|
|
|
$courseType->history_course_signs_total = $historyCourse->sum('course_type_signs_pass_unique');
|
|
|
|
|
|
|
|
|
|
$courseType->course_periods_total = $baseCoursePeriodsTotal + $historyCourse->count();
|
|
|
|
|
// 课程
|
|
|
|
|
$courses = Course::where('type', $courseType->id)->get();
|
|
|
|
|
// 已开设期数
|
|
|
|
|
$courseType->course_periods_total = Course::where('type', $courseType->id)->count() + $courseType->history_course_periods_total;
|
|
|
|
|
// 培养人数去重
|
|
|
|
|
$courseType->course_signs_total = $historyCourse->sum('course_type_signs_pass_unique') + CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $courses->pluck('id'), null);
|
|
|
|
|
$courseType->course_signs_total = $courseType->history_course_signs_total + CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $courses->pluck('id'), null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|