diff --git a/backend/controllers/participantController.js b/backend/controllers/participantController.js
index 0469a78..c06d1e9 100644
--- a/backend/controllers/participantController.js
+++ b/backend/controllers/participantController.js
@@ -40,12 +40,26 @@ export const updateParticipantGroup = async (req, res) => {
participant.groupId = groupId || null;
await participant.save();
- // Emit Socket-Event
- if (participant.diaryDate?.clubId) {
- emitParticipantUpdated(participant.diaryDate.clubId, dateId, participant);
+ // Lade den Participant erneut aus der DB, um sicherzustellen, dass wir den aktuellen Wert haben
+ const updatedParticipant = await Participant.findOne({
+ where: {
+ diaryDateId: dateId,
+ memberId: memberId
+ },
+ include: [{
+ model: DiaryDates,
+ as: 'diaryDate',
+ attributes: ['clubId']
+ }]
+ });
+
+ // Emit Socket-Event mit dem aktualisierten Participant
+ if (updatedParticipant?.diaryDate?.clubId) {
+ console.log('📡 [Backend] Emit participant:updated mit groupId:', updatedParticipant.groupId);
+ emitParticipantUpdated(updatedParticipant.diaryDate.clubId, dateId, updatedParticipant);
}
- res.status(200).json(participant);
+ res.status(200).json(updatedParticipant || participant);
} catch (error) {
devLog(error);
res.status(500).json({ error: 'Fehler beim Aktualisieren der Teilnehmer-Gruppenzuordnung' });
diff --git a/backend/services/socketService.js b/backend/services/socketService.js
index a1e0238..0defb3b 100644
--- a/backend/services/socketService.js
+++ b/backend/services/socketService.js
@@ -64,6 +64,7 @@ export const emitParticipantRemoved = (clubId, dateId, participantId) => {
};
export const emitParticipantUpdated = (clubId, dateId, participant) => {
+ console.log('📡 [Socket] Emit participant:updated für Club', clubId, 'Date', dateId, 'Participant:', participant);
emitToClub(clubId, 'participant:updated', { dateId, participant });
};
diff --git a/frontend/src/services/socketService.js b/frontend/src/services/socketService.js
index 2a3574a..f6fea2a 100644
--- a/frontend/src/services/socketService.js
+++ b/frontend/src/services/socketService.js
@@ -77,7 +77,12 @@ export const onParticipantRemoved = (callback) => {
export const onParticipantUpdated = (callback) => {
if (socket) {
- socket.on('participant:updated', callback);
+ socket.on('participant:updated', (data) => {
+ console.log('📡 [Socket] participant:updated empfangen:', data);
+ callback(data);
+ });
+ } else {
+ console.warn('⚠️ [Socket] onParticipantUpdated: Socket nicht verbunden');
}
};
diff --git a/frontend/src/views/DiaryView.vue b/frontend/src/views/DiaryView.vue
index fba8e7e..d96c54b 100644
--- a/frontend/src/views/DiaryView.vue
+++ b/frontend/src/views/DiaryView.vue
@@ -189,37 +189,39 @@
-
-
-
-
-
- Teilnehmer zuordnen
-
-
-
-
-
-
+
+
+
+
+
+
+ Teilnehmer zuordnen
+
+
+
+
+
+
+
|
@@ -277,11 +279,12 @@
{{ groupItem.groupsGroupActivity.name }} |
|
-
-
-
+
+
+
+
Teilnehmer zuordnen
+
|
@@ -424,10 +428,11 @@