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:
@@ -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) => ({
|
||||
|
||||
Reference in New Issue
Block a user