|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
/**
|
|
|
* 近 7 天老师组卷 + 学情分析套数(exam_analysis_results 按 paper_id 去重,一套卷计 1)。
|
|
|
- * 按老师:学生数·本/上 = 组卷∪学情 student_id 合并去重,分列本周期与上周期;老师列含 teacher_id,如 龚 (433)。
|
|
|
+ * 按老师:学案数量、分析数量、学生数为「本 / 上」并列(本大于上则绿色);保留学案·环比、学情·环比;学生数为组卷∪学情去重。
|
|
|
* 用法:
|
|
|
* php scripts/report_teacher_weekly_stats.php
|
|
|
* php scripts/report_teacher_weekly_stats.php > storage/app/reports/teacher-weekly-stats-$(date +%Y-%m-%d)_$(date +%H%M%S).md
|
|
|
@@ -119,6 +119,16 @@ $compareCellHtml = static function (int $cur, int $prev): string {
|
|
|
return $text;
|
|
|
};
|
|
|
|
|
|
+/** 「本 / 上」并列显示;仅当本 > 上时整体标绿 */
|
|
|
+$slashPairGreenHtml = static function (int $cur, int $prev): string {
|
|
|
+ $text = $cur.' / '.$prev;
|
|
|
+ if ($cur > $prev) {
|
|
|
+ return '<span style="color:#16a34a;font-weight:600;">'.$text.'</span>';
|
|
|
+ }
|
|
|
+
|
|
|
+ return $text;
|
|
|
+};
|
|
|
+
|
|
|
$byTeacher = \Illuminate\Support\Facades\DB::table('papers')
|
|
|
->whereNotNull('teacher_id')
|
|
|
->where('teacher_id', '!=', '')
|
|
|
@@ -359,9 +369,9 @@ $buildChartSvg = static function (array $curDaily, array $prevDaily): string {
|
|
|
$lx = $padL + $gw - 168;
|
|
|
$ly = $padT + 4;
|
|
|
$items = [
|
|
|
- ['#2563eb', '组卷·本周期', ''],
|
|
|
+ ['#2563eb', '学案·本周期', ''],
|
|
|
['#ea580c', '学情·本周期', ''],
|
|
|
- ['#93c5fd', '组卷·上周期', '6,4'],
|
|
|
+ ['#93c5fd', '学案·上周期', '6,4'],
|
|
|
['#fdba74', '学情·上周期', '6,4'],
|
|
|
];
|
|
|
foreach ($items as $idx => $it) {
|
|
|
@@ -417,7 +427,6 @@ echo sprintf("| 有组卷老师数 | %d | %d | %s |\n", $teachersCur, $teachersP
|
|
|
|
|
|
echo "\n### 近7段每日对比(本周期与上周期时间轴对齐)\n\n";
|
|
|
echo '<div class="weekly-chart">';
|
|
|
-echo '<p style="font-size:9pt;color:#4b5563;margin:0 0 6px 0;">横轴为统计窗口均分的 7 段,数字为每段「组卷套数 / 学情分析套数(卷去重)」;实线本周期,虚线上一同期。</p>';
|
|
|
echo $chartSvg;
|
|
|
echo "</div>\n\n";
|
|
|
|
|
|
@@ -425,13 +434,13 @@ echo "### 按老师\n\n";
|
|
|
|
|
|
echo '<table class="weekly-teacher-table">';
|
|
|
echo '<colgroup>';
|
|
|
-echo '<col style="width:4%" /><col style="width:11%" />';
|
|
|
-echo '<col style="width:7%" /><col style="width:7%" /><col style="width:8%" />';
|
|
|
-echo '<col class="col-an" style="width:9%" /><col class="col-an" style="width:9%" /><col style="width:8%" />';
|
|
|
-echo '<col class="col-stu" style="width:8%" /><col class="col-stu" style="width:8%" />';
|
|
|
+echo '<col style="width:4%" /><col style="width:12%" />';
|
|
|
+echo '<col class="col-slash" style="width:10%" /><col style="width:13%" />';
|
|
|
+echo '<col class="col-slash" style="width:10%" /><col style="width:13%" />';
|
|
|
+echo '<col class="col-slash" style="width:10%" />';
|
|
|
echo '</colgroup>';
|
|
|
echo '<thead><tr>';
|
|
|
-echo '<th>排名</th><th>老师</th><th>组卷·本</th><th>组卷·上</th><th>组卷·环比</th><th>学情·本</th><th>学情·上</th><th>学情·环比</th><th>学生数·本</th><th>学生数·上</th>';
|
|
|
+echo '<th>排名</th><th>老师</th><th>学案数量</th><th>学案·环比</th><th>分析数量</th><th>学情·环比</th><th>学生数</th>';
|
|
|
echo "</tr></thead>\n<tbody>\n";
|
|
|
|
|
|
$i = 1;
|
|
|
@@ -450,14 +459,11 @@ foreach ($rows as $r) {
|
|
|
echo '<tr>';
|
|
|
echo '<td style="text-align:right">'.((string) $i++).'</td>';
|
|
|
echo '<td class="td-name">'.$nameWithId.'</td>';
|
|
|
- echo '<td style="text-align:right">'.((string) $pc).'</td>';
|
|
|
- echo '<td style="text-align:right">'.((string) $pp).'</td>';
|
|
|
+ echo '<td style="text-align:right" class="td-slash" title="本周期 / 上周期:组卷套数">'.$slashPairGreenHtml($pc, $pp).'</td>';
|
|
|
echo '<td>'.$compareCellHtml($pc, $pp).'</td>';
|
|
|
- echo '<td style="text-align:right" class="td-an">'.((string) $ac).'</td>';
|
|
|
- echo '<td style="text-align:right" class="td-an">'.((string) $ap).'</td>';
|
|
|
+ echo '<td style="text-align:right" class="td-slash" title="本周期 / 上周期:学情分析套数(卷去重)">'.$slashPairGreenHtml($ac, $ap).'</td>';
|
|
|
echo '<td>'.$compareCellHtml($ac, $ap).'</td>';
|
|
|
- echo '<td style="text-align:right" class="td-stu" title="组卷∪学情,学生合并去重">'.$stuC.'</td>';
|
|
|
- echo '<td style="text-align:right" class="td-stu" title="组卷∪学情,学生合并去重">'.$stuP.'</td>';
|
|
|
+ echo '<td style="text-align:right" class="td-slash td-stu" title="本周期 / 上周期:组卷∪学情学生合并去重">'.$slashPairGreenHtml($stuC, $stuP).'</td>';
|
|
|
echo "</tr>\n";
|
|
|
}
|
|
|
echo "</tbody></table>\n";
|