Refactor political office type references in FalukantService: Update the alias for PoliticalOfficeType from 'officeType' to 'type' in multiple locations to improve clarity and consistency in candidate ranking logic.

This commit is contained in:
Torsten Schulz (local)
2026-03-23 11:11:40 +01:00
parent 57ab85fe10
commit f2343098d2
2 changed files with 409 additions and 6 deletions

View File

@@ -5373,7 +5373,7 @@ class FalukantService extends BaseService {
const [politicalOffices, politicalHistories] = await Promise.all([
PoliticalOffice.findAll({
where: { characterId: character.id },
include: [{ model: PoliticalOfficeType, as: 'officeType', attributes: ['name'] }],
include: [{ model: PoliticalOfficeType, as: 'type', attributes: ['name'] }],
attributes: ['officeTypeId']
}),
PoliticalOfficeHistory.findAll({
@@ -5385,8 +5385,8 @@ class FalukantService extends BaseService {
const candidates = [
...politicalOffices.map((office) => ({
rank: POLITICAL_OFFICE_RANKS[office.officeType?.name] || 0,
name: office.officeType?.name || null
rank: POLITICAL_OFFICE_RANKS[office.type?.name] || 0,
name: office.type?.name || null
})),
...politicalHistories.map((history) => ({
rank: POLITICAL_OFFICE_RANKS[history.officeTypeHistory?.name] || 0,
@@ -5407,7 +5407,7 @@ class FalukantService extends BaseService {
const [politicalOffices, politicalHistories, churchOffices] = await Promise.all([
PoliticalOffice.findAll({
where: { characterId: character.id },
include: [{ model: PoliticalOfficeType, as: 'officeType', attributes: ['name'] }],
include: [{ model: PoliticalOfficeType, as: 'type', attributes: ['name'] }],
attributes: ['officeTypeId']
}),
PoliticalOfficeHistory.findAll({
@@ -5424,8 +5424,8 @@ class FalukantService extends BaseService {
const candidates = [
...politicalOffices.map((office) => ({
rank: POLITICAL_OFFICE_RANKS[office.officeType?.name] || 0,
name: office.officeType?.name || null,
rank: POLITICAL_OFFICE_RANKS[office.type?.name] || 0,
name: office.type?.name || null,
source: 'political'
})),
...politicalHistories.map((history) => ({