Compare commits

...

2 Commits

View File

@@ -147,9 +147,31 @@ async function calcRegionalSellPrice(product, knowledgeFactor, regionId, worthPe
async function getCumulativeTaxPercentWithExemptions(userId, regionId) { async function getCumulativeTaxPercentWithExemptions(userId, regionId) {
if (!regionId) return 0; if (!regionId) return 0;
// fetch user's political offices (active) and their region types // fetch user's political offices (active) and their region types
// PoliticalOffice hat keine userId Spalte, daher müssen wir über FalukantCharacter filtern
const offices = await PoliticalOffice.findAll({ const offices = await PoliticalOffice.findAll({
where: { userId }, include: [
include: [{ model: PoliticalOfficeType, as: 'type', attributes: ['name'] }, { model: RegionData, as: 'region', include: [{ model: RegionType, as: 'regionType', attributes: ['labelTr'] }] }] {
model: FalukantCharacter,
as: 'holder',
where: { userId },
required: true,
attributes: []
},
{
model: PoliticalOfficeType,
as: 'type',
attributes: ['name']
},
{
model: RegionData,
as: 'region',
include: [{
model: RegionType,
as: 'regionType',
attributes: ['labelTr']
}]
}
]
}); });
// build set of exempt region type labels from user's offices // build set of exempt region type labels from user's offices