fix(v3.4.6): fix reservation cascade, remove calendar mocks, strip auto meet links, friendly dates, dynamic building floors and career filter

This commit is contained in:
2026-10-08 08:26:15 -03:00
parent 25039efdeb
commit 368dc71b14
23 changed files with 291 additions and 149 deletions
+21 -32
View File
@@ -260,36 +260,11 @@
{% block extra_js %}
<script type="application/json" id="classroom-data">
{
{% for c in classroom_list %}
"{{ c.id }}": {
"id": {{ c.id }},
"building_id": {{ (c.building_id or 0)|tojson }},
"building_name": {{ c.building_name|tojson }},
"floor": {{ c.floor|tojson }},
"floor_display": {{ c.floor_display|tojson }},
"code": {{ c.code|tojson }},
"code_display": {{ c.code_display|tojson }},
"location_display": {{ c.location_display|tojson }},
"capacity": {{ c.capacity_display|tojson }},
"capacity_num": {{ c.capacity }},
"is_virtual": {{ c.is_virtual|tojson }}
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{{ classroom_data_json | safe }}
</script>
<script type="application/json" id="commission-data">
{
{% for c in commission_list %}
"{{ c.id }}": {
"id": {{ c.id }},
"code": {{ c.code|tojson }},
"virtual_link": {{ (c.virtual_link or '')|tojson }},
"max_students": {{ c.max_students }}
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{{ commission_data_json | safe }}
</script>
<script>
@@ -334,15 +309,24 @@ $(document).ready(function() {
const floors = new Set();
Object.values(classroomData).forEach(function(room) {
if (String(room.building_id) === String(selectedBldg)) {
const matchesBuilding = (String(room.building_id) === String(selectedBldg)) ||
(!room.is_virtual && String(selectedBldg) === '1') ||
(room.building_name && room.building_name.toLowerCase().includes('central') && String(selectedBldg) === '1');
if (matchesBuilding && room.floor) {
floors.add(room.floor);
}
});
const sortedFloors = Array.from(floors).sort(function(a, b) {
if (a === '0' || a === 'PB') return -1;
if (b === '0' || b === 'PB') return 1;
return String(a).localeCompare(String(b), undefined, {numeric: true});
const fA = String(a || '').toUpperCase();
const fB = String(b || '').toUpperCase();
if (fA.includes('SUB') || fA === 'SS') return -1;
if (fB.includes('SUB') || fB === 'SS') return 1;
if (fA === '0' || fA.includes('PB') || fA.includes('PLANTA BAJA')) return -1;
if (fB === '0' || fB.includes('PB') || fB.includes('PLANTA BAJA')) return 1;
if (fA.includes('EP') || fA.includes('ENTRE')) return -1;
if (fB.includes('EP') || fB.includes('ENTRE')) return 1;
return fA.localeCompare(fB, undefined, {numeric: true});
});
sortedFloors.forEach(function(fl) {
@@ -368,7 +352,12 @@ $(document).ready(function() {
}
const matchingRooms = Object.values(classroomData).filter(function(room) {
return String(room.building_id) === String(selectedBldg) && String(room.floor) === String(selectedFloor);
const matchesBuilding = !selectedBldg ||
(String(room.building_id) === String(selectedBldg)) ||
(!room.is_virtual && String(selectedBldg) === '1') ||
(room.building_name && room.building_name.toLowerCase().includes('central') && String(selectedBldg) === '1');
const matchesFloor = String(room.floor).toLowerCase() === String(selectedFloor).toLowerCase();
return matchesBuilding && matchesFloor;
});
matchingRooms.sort(function(a, b) { return a.code.localeCompare(b.code); });