@@ -84,33 +84,43 @@
{{ section.title }}
{{ item.label }}
+ {% if item.description %}
+
{{ item.description }}
+ {% endif %}
+ {% if item.no_schedule_warning %}
+
+ ⚠ Нет данных о расписании в этих аудиториях
+
+ {% endif %}
{% if item.source_labels %}
{{ item.source_labels | join(', ') }}
{% endif %}
+
+ Проведено {{ item.pct_conducted }}%
+ Пропущено {{ item.pct_missed }}%
+ Не по расписанию {{ item.pct_other }}%
+
-
-
- {% for week in item.weeks %}
-
- | {{ week.long }} |
- {{ week.total_pairs }} |
- {{ week.conducted_display }} |
- {{ week.missed_display }} |
- {{ week.other_display }} |
-
- {{ week.scheme_html | safe }}
- |
-
- {% endfor %}
-
-
+
+ {% for week in item.weeks %}
+
+
+
+ Проведено {{ week.conducted_display }}
+ Пропущено {{ week.missed_display }}
+ Не по расписанию {{ week.other_display }}
+
+
+ {{ week.scheme_html | safe }}
+
+
+ {% endfor %}
{% endfor %}
diff --git a/template/report_class.js b/template/report_class.js
index 4a992a9..69c0959 100644
--- a/template/report_class.js
+++ b/template/report_class.js
@@ -56,7 +56,7 @@
borderRadius: 4,
},
{
- label: "Иное",
+ label: "Не по расписанию",
data: other,
backgroundColor: "#f59e0b",
stack: "pairs",
@@ -74,6 +74,7 @@
options: {
responsive: true,
maintainAspectRatio: false,
+ animation: false,
interaction: {
mode: "index",
intersect: false,
@@ -156,8 +157,84 @@
}
}
+ // ---- Print support: convert canvases to static images ----
+ function prepareForPrint() {
+ var report = window.__CLASS_REPORT__ || {};
+ var sections = Array.isArray(report.sections) ? report.sections : [];
+ var allEntries = sections.flatMap(function (s) {
+ return s.entries || [];
+ });
+
+ // Activate each class one-by-one, build its chart, capture the image,
+ // then move on. This ensures Chart.js renders each canvas properly.
+ var idx = 0;
+ var storedImages = {};
+
+ function processNext() {
+ if (idx >= allEntries.length) {
+ // All done — replace canvases with stored images
+ Object.keys(storedImages).forEach(function (classId) {
+ var canvas = qs('.week-chart[data-chart-for="' + classId + '"]');
+ if (!canvas) return;
+ var img = document.createElement("img");
+ img.src = storedImages[classId];
+ img.alt = "Chart";
+ img.style.width = "100%";
+ img.style.height = "320px";
+ img.style.objectFit = "contain";
+ canvas.parentNode.replaceChild(img, canvas);
+ });
+ // Restore original class
+ if (originalClassId) {
+ setActiveClass(originalClassId, false, report);
+ }
+ // Short delay then open print dialog
+ setTimeout(function () {
+ window.print();
+ }, 50);
+ return;
+ }
+
+ var entry = allEntries[idx];
+ var cid = entry.id;
+ if (!cid) {
+ idx++;
+ processNext();
+ return;
+ }
+
+ // Switch to this class to make its canvas visible
+ setActiveClass(cid, false, report);
+
+ // Wait for layout + Chart.js to render
+ setTimeout(function () {
+ // Build chart if not already built
+ buildChartForClass(cid, report);
+ // Wait again for chart animation to finish
+ setTimeout(function () {
+ var chart = chartStore.get(cid);
+ if (chart) {
+ storedImages[cid] = chart.toBase64Image();
+ }
+ idx++;
+ processNext();
+ }, 100);
+ }, 50);
+ }
+
+ // Remember which class was active
+ var originalClassId = null;
+ var activeBlock = qs(".class-block.active");
+ if (activeBlock) originalClassId = activeBlock.dataset.classId;
+
+ // Start sequential processing from first entry
+ idx = 0;
+ processNext();
+ }
+
window.printReport = function printReport() {
- window.print();
+ prepareForPrint();
+ // print dialog opens inside prepareForPrint after all charts are processed
};
if (document.readyState === "loading") {