refactor(clickTtPlayerRegistrationService): update nationality selection and gender handling
- Modified nationality selection logic to include an additional condition for 'WONoSelectionString' and a specific value '209', enhancing form validation. - Updated gender mapping to exclude disabled options, improving the accuracy of gender selection during player registration.
This commit is contained in:
@@ -39,7 +39,7 @@ function escapeRegExp(value) {
|
||||
|
||||
function buildDebugHtmlPath() {
|
||||
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
||||
return path.join(process.cwd(), 'backend', 'tmp', `clicktt-debug-${timestamp}.html`);
|
||||
return path.join(process.cwd(), 'tmp', `clicktt-debug-${timestamp}.html`);
|
||||
}
|
||||
|
||||
class ClickTtPlayerRegistrationService {
|
||||
@@ -438,10 +438,10 @@ 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$=".27"]').first();
|
||||
const nationalitySelect = form.locator('select[name$=".31.1.1.5.13"]:not([disabled])').first();
|
||||
if (await nationalitySelect.count()) {
|
||||
const currentValue = await nationalitySelect.inputValue().catch(() => 'WONoSelectionString');
|
||||
if (!currentValue || currentValue === 'WONoSelectionString') {
|
||||
if (!currentValue || currentValue === 'WONoSelectionString' || currentValue === '209') {
|
||||
await this._selectOptionByLabelContains(nationalitySelect, 'Deutschland');
|
||||
}
|
||||
}
|
||||
@@ -455,10 +455,10 @@ class ClickTtPlayerRegistrationService {
|
||||
}
|
||||
|
||||
const genderMap = {
|
||||
female: 'input[id^="radioGenderFemale_"]',
|
||||
male: 'input[id^="radioGenderMale_"]',
|
||||
diverse: 'input[id^="radioGenderNonBinary_"]',
|
||||
unknown: 'input[id^="radioGenderNotSpecified_"]'
|
||||
female: 'input[id^="radioGenderFemale_"]:not([disabled])',
|
||||
male: 'input[id^="radioGenderMale_"]:not([disabled])',
|
||||
diverse: 'input[id^="radioGenderNonBinary_"]:not([disabled])',
|
||||
unknown: 'input[id^="radioGenderNotSpecified_"]:not([disabled])'
|
||||
};
|
||||
const genderSelector = genderMap[member.gender] || genderMap.unknown;
|
||||
const genderRadio = form.locator(genderSelector).first();
|
||||
|
||||
Reference in New Issue
Block a user