Refactor group ID handling in DiaryView and related services for consistency

Updated the handling of group IDs in DiaryView.vue to ensure they are consistently treated as strings. Enhanced the DiaryDateActivityService to filter out duplicate group activities and ensure proper handling of group IDs during updates. This improves data integrity and consistency across the application.
This commit is contained in:
Torsten Schulz (local)
2025-11-08 22:31:38 +01:00
parent d79e71d6d7
commit eb37532de2
3 changed files with 38 additions and 30 deletions

View File

@@ -208,6 +208,17 @@ class DiaryDateActivityService {
// Auch für GroupActivities
if (activityData.groupActivities && activityData.groupActivities.length > 0) {
const seenGroupActivityIds = new Set();
activityData.groupActivities = activityData.groupActivities.filter(groupActivity => {
if (!groupActivity || groupActivity.id === undefined || groupActivity.id === null) {
return false;
}
if (seenGroupActivityIds.has(groupActivity.id)) {
return false;
}
seenGroupActivityIds.add(groupActivity.id);
return true;
});
for (const groupActivity of activityData.groupActivities) {
if (groupActivity.groupPredefinedActivity) {
// Hole die erste verfügbare Image-ID direkt aus der Datenbank