Skip to content

Commit 5617945

Browse files
authored
Update fast-search-card.js
1 parent 9a31ead commit 5617945

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

dist/fast-search-card.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7369,7 +7369,7 @@ class FastSearchCard extends HTMLElement {
73697369
// Diese werden jetzt in initializeTimerTab gehandhabt!
73707370

73717371
// Load existing timers
7372-
this.loadActiveTimers(item.id);
7372+
this.(item.id);
73737373
}
73747374

73757375
handleTimerToggle(button, container) {
@@ -7672,7 +7672,7 @@ class FastSearchCard extends HTMLElement {
76727672
// Close after success
76737673
setTimeout(() => {
76747674
this.closeTimeSelection(timeContainer, parentContainer);
7675-
this.loadActiveTimers(item.id); // Refresh timer list
7675+
this.(item.id); // Refresh timer list
76767676
}, 1000);
76777677

76787678
} catch (error) {
@@ -7686,7 +7686,7 @@ class FastSearchCard extends HTMLElement {
76867686

76877687
// ✅ NEU: Timer Liste neu laden nach Erfolg
76887688
setTimeout(() => {
7689-
this.loadActiveTimers(item.id);
7689+
this.(item.id);
76907690
}, 400); // Warten bis Animation fertig
76917691

76927692
}, 1000);
@@ -8038,7 +8038,7 @@ class FastSearchCard extends HTMLElement {
80388038

80398039
// Refresh timer list
80408040
setTimeout(() => {
8041-
this.loadActiveTimers(item.id);
8041+
this.(item.id);
80428042
}, 500);
80438043

80448044
} catch (error) {
@@ -8126,12 +8126,17 @@ class FastSearchCard extends HTMLElement {
81268126

81278127
console.log('📋 Alle Scheduler Items (korrekte API):', allSchedules);
81288128

8129-
// Filter für diese Entity
8129+
// Filter für diese Entity UND nur echte Timer (keine Wochentage)
81308130
const entityTimers = allSchedules.filter(schedule => {
81318131
// Prüfe ob diese Entity in den timeslots/actions vorkommt
8132-
return schedule.timeslots && schedule.timeslots.some(slot =>
8132+
const belongsToEntity = schedule.timeslots && schedule.timeslots.some(slot =>
81338133
slot.actions && slot.actions.some(action => action.entity_id === entityId)
81348134
);
8135+
8136+
// Timer = keine Wochentage oder leere Wochentage-Array
8137+
const isTimer = !schedule.weekdays || schedule.weekdays.length === 0;
8138+
8139+
return belongsToEntity && isTimer;
81358140
});
81368141

81378142
console.log(`🎯 Timer für ${entityId}:`, entityTimers);
@@ -10749,12 +10754,18 @@ class FastSearchCard extends HTMLElement {
1074910754

1075010755
console.log('🔍 DEBUG: Alle Schedule-Entitäten:', allSchedules.length);
1075110756

10752-
// KORRIGIERTES FILTERING: entities statt actions in timeslots
10757+
// KORRIGIERTES FILTERING: entities statt actions in timeslots + nur echte Zeitpläne
1075310758
const scheduleEntities = allSchedules.filter(schedule => {
1075410759
const entities = schedule.attributes.entities || [];
1075510760
const hasMatch = entities.includes(entityId);
10756-
console.log(`🔍 Schedule ${schedule.entity_id}: entities=${JSON.stringify(entities)}, hasMatch=${hasMatch}`);
10757-
return hasMatch;
10761+
10762+
// Zeitplan = hat Wochentage definiert (nicht leer)
10763+
const weekdays = schedule.attributes.weekdays || [];
10764+
const isSchedule = weekdays.length > 0;
10765+
10766+
console.log(`🔍 Schedule ${schedule.entity_id}: entities=${JSON.stringify(entities)}, weekdays=${JSON.stringify(weekdays)}, hasMatch=${hasMatch}, isSchedule=${isSchedule}`);
10767+
10768+
return hasMatch && isSchedule;
1075810769
});
1075910770

1076010771
console.log(`📋 Gefundene Zeitpläne für ${entityId}:`, scheduleEntities.length);

0 commit comments

Comments
 (0)