|
|
|
|
@ -226,14 +226,14 @@ class OtherController extends CommonController
|
|
|
|
|
|
|
|
|
|
// 对每个 CourseType 进行统计
|
|
|
|
|
foreach ($courseTypes as $courseType) {
|
|
|
|
|
// 历史已开设期数(添加时间范围限制)
|
|
|
|
|
// 历史课程数据(添加时间范围限制)
|
|
|
|
|
$historyCourse = HistoryCourse::whereHas('typeDetail', function ($query) use ($courseType) {
|
|
|
|
|
$query->where('name', 'like', '%' . $courseType->name . '%');
|
|
|
|
|
})->where(function ($query) use ($configStartDate, $configEndDate) {
|
|
|
|
|
$query->whereBetween('start_time', [$configStartDate, $configEndDate])
|
|
|
|
|
->orWhereBetween('end_time', [$configStartDate, $configEndDate]);
|
|
|
|
|
})->get();
|
|
|
|
|
// 课程(添加时间范围限制)
|
|
|
|
|
// 实际课程数据(添加时间范围限制)
|
|
|
|
|
$courses = Course::where('type', $courseType->id)->where('is_chart', 1)
|
|
|
|
|
->where(function ($query) use ($configStartDate, $configEndDate) {
|
|
|
|
|
$query->whereBetween('start_date', [$configStartDate, $configEndDate])
|
|
|
|
|
@ -242,11 +242,7 @@ class OtherController extends CommonController
|
|
|
|
|
// 历史课程期数
|
|
|
|
|
$courseType->history_course_periods_total = $historyCourse->count();
|
|
|
|
|
// 现在课程期数(添加时间范围限制)
|
|
|
|
|
$courseType->now_course_periods_total = Course::where('type', $courseType->id)->where('is_chart', 1)
|
|
|
|
|
->where(function ($query) use ($configStartDate, $configEndDate) {
|
|
|
|
|
$query->whereBetween('start_date', [$configStartDate, $configEndDate])
|
|
|
|
|
->orWhereBetween('end_date', [$configStartDate, $configEndDate]);
|
|
|
|
|
})->count();
|
|
|
|
|
$courseType->now_course_periods_total = $courses->count();
|
|
|
|
|
|
|
|
|
|
// 历史课程培养人数去重
|
|
|
|
|
$courseType->history_course_signs_total = $historyCourse->sum('course_type_signs_pass_unique');
|
|
|
|
|
|