Add logic to include active trainers as newsletter recipients
Some checks failed
Code Analysis and Production Deploy / analyze (push) Has been skipped
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 2m1s
Code Analysis and Production Deploy / analyze (pull_request) Failing after 3m16s
Code Analysis and Production Deploy / deploy-production (pull_request) Has been skipped
Code Analysis and Production Deploy / deploy-test (pull_request) Has been skipped
Require Package Version Change / check (pull_request) Successful in 11s
Some checks failed
Code Analysis and Production Deploy / analyze (push) Has been skipped
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 2m1s
Code Analysis and Production Deploy / analyze (pull_request) Failing after 3m16s
Code Analysis and Production Deploy / deploy-production (pull_request) Has been skipped
Code Analysis and Production Deploy / deploy-test (pull_request) Has been skipped
Require Package Version Change / check (pull_request) Successful in 11s
- Enhanced the getRecipientsByGroup function to filter and add active trainers from users.json to the newsletter recipients list. - Ensured that duplicate emails are not added to the recipients array.
This commit is contained in:
@@ -236,6 +236,22 @@ export async function getRecipientsByGroup(targetGroup) {
|
|||||||
email: m.email,
|
email: m.email,
|
||||||
name: `${m.firstName || ''} ${m.lastName || ''}`.trim() || m.name || ''
|
name: `${m.firstName || ''} ${m.lastName || ''}`.trim() || m.name || ''
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// Zusätzlich aktive Trainer aus users.json anschreiben
|
||||||
|
users
|
||||||
|
.filter(u => {
|
||||||
|
if (!u.active || !u.email || !u.email.trim()) return false
|
||||||
|
const roles = Array.isArray(u.roles) ? u.roles : (u.role ? [u.role] : [])
|
||||||
|
return roles.includes('trainer')
|
||||||
|
})
|
||||||
|
.forEach(u => {
|
||||||
|
if (!recipients.find(r => r.email.toLowerCase().trim() === u.email.toLowerCase().trim())) {
|
||||||
|
recipients.push({
|
||||||
|
email: u.email.trim(),
|
||||||
|
name: u.name || ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'mannschaftsspieler':
|
case 'mannschaftsspieler':
|
||||||
|
|||||||
Reference in New Issue
Block a user