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