averbraeck / housinggame-facilitator

Facilitator app for the housing game
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Implement tax related measures in tax calculation #19

Closed averbraeck closed 5 months ago

averbraeck commented 9 months ago

The tax increase (or reduction) as a result of a measure needs to be implemented in the tax calculation in the facilitator app.

averbraeck commented 5 months ago

Calculation has been included. See snippet below:

var cumulativeNewsEffects = CumulativeNewsEffects.readCumulativeNewsEffects(data.getDataSource(), 
        data.getScenario(), data.getCurrentRoundNumber());

for (var community : communityMap.keySet())
{
    List<TaxRecord> taxList =
            dslContext.selectFrom(Tables.TAX).where(Tables.TAX.COMMUNITY_ID.eq(community.getId())).fetch();
    taxMap.put(community, 1000);

    // tax change based on measures
    int txc = (int) cumulativeNewsEffects.get(community.getId()).getTaxChange();

    for (TaxRecord tax : taxList)
    {
        int nr = communityMap.get(community);
        if (nr >= tax.getMinimumInhabitants() && nr <= tax.getMaximumInhabitants())
        {
            taxMap.put(community, tax.getTaxCost().intValue() + txc);
            break;
        }
    }
}
averbraeck commented 5 months ago

Note that the database needs to change the round 4 tax effects to:

image

averbraeck commented 5 months ago

The 5000 value instead of 5 has been changed in the database for all scenarios.

averbraeck commented 5 months ago

This is now correctly applied:

image