From 9d13a2e211765e4b19177a3089980f244b32a0f0 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 11 Mar 2026 17:32:02 +0100 Subject: [PATCH] refactor(clickTtPlayerRegistrationService): improve nationality selection logic - Updated nationality selection to handle multiple selectors, enhancing flexibility in form filling. - Added checks for 'WONoSelectionString' and specific values to improve validation during player registration. - Streamlined the selection process by breaking out of the loop once a valid selection is made, improving efficiency. --- .../services/clickTtPlayerRegistrationService.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/services/clickTtPlayerRegistrationService.js b/backend/services/clickTtPlayerRegistrationService.js index f66c0bb4..11164c75 100644 --- a/backend/services/clickTtPlayerRegistrationService.js +++ b/backend/services/clickTtPlayerRegistrationService.js @@ -460,12 +460,21 @@ class ClickTtPlayerRegistrationService { await this._fillIfEmpty(form.locator('input[name$=".17"]').nth(1), member.city || ''); await this._fillIfEmpty(form.locator('input[name$=".5"]').last(), email || ''); - const nationalitySelect = form.locator('select[name$=".31.1.1.5.13"]:not([disabled])').first(); - if (await nationalitySelect.count()) { + const nationalitySelectors = [ + 'select[name$=".31.1.1.5.13"]:not([disabled])', + 'select[name$=".27"]:not([disabled])' + ]; + for (const selector of nationalitySelectors) { + const nationalitySelect = form.locator(selector).first(); + if (!(await nationalitySelect.count())) { + continue; + } + const currentValue = await nationalitySelect.inputValue().catch(() => 'WONoSelectionString'); if (!currentValue || currentValue === 'WONoSelectionString' || currentValue === '209') { await this._selectOptionByLabelContains(nationalitySelect, 'Deutschland'); } + break; } const countrySelect = form.locator('select[name$=".21.3"]').first();