Refactor FalukantService and update UI components: Removed debug logging from FalukantService, added age requirement messages in i18n files, and improved age validation display in PoliticsView. This enhances user experience and code clarity regarding age eligibility for political applications.
This commit is contained in:
@@ -4409,7 +4409,6 @@ class FalukantService extends BaseService {
|
||||
const characterId = character.id;
|
||||
const ageDays = character.birthdate ? calcAge(character.birthdate) : 0;
|
||||
const canApplyByAge = ageDays >= FalukantService.MIN_AGE_POLITICS_DAYS;
|
||||
console.log('[getOpenPolitics] characterId=', characterId, 'birthdate=', character.birthdate, 'ageDays=', ageDays, 'MIN=', FalukantService.MIN_AGE_POLITICS_DAYS, 'canApplyByAge=', canApplyByAge);
|
||||
const rows = await sequelize.query(
|
||||
FalukantService.RECURSIVE_REGION_SEARCH,
|
||||
{
|
||||
@@ -4485,7 +4484,6 @@ class FalukantService extends BaseService {
|
||||
};
|
||||
})
|
||||
.filter(election => !election.alreadyApplied); // Nur Positionen ohne bestehende Bewerbung
|
||||
console.log('[getOpenPolitics] returning', result.length, 'entries, canApplyByAge on first:', result[0]?.canApplyByAge);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4502,9 +4500,7 @@ class FalukantService extends BaseService {
|
||||
|
||||
// 2) Mindestalter 16 (Spieljahre = 16 Tage Realzeit)
|
||||
const ageDays = character.birthdate ? calcAge(character.birthdate) : 0;
|
||||
console.log('[applyForElections] characterId=', character.id, 'birthdate=', character.birthdate, 'ageDays=', ageDays, 'MIN=', FalukantService.MIN_AGE_POLITICS_DAYS);
|
||||
if (ageDays < FalukantService.MIN_AGE_POLITICS_DAYS) {
|
||||
console.log('[applyForElections] rejected: too_young');
|
||||
throw new Error('too_young');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user