remove common area calculation

This commit is contained in:
Niklas Meinzer
2024-09-29 09:20:57 +02:00
parent 302c8c3f4f
commit 55572f71c4
2 changed files with 27 additions and 52 deletions

View File

@@ -32,30 +32,14 @@ class Flat {
return room ? this.sizeShared / this.numPeople * room.numPeople : 0; return room ? this.sizeShared / this.numPeople * room.numPeople : 0;
} }
// Calculates the share of the project wide common area
// the party has to pay for.
// Currently done by number of people in the party.
calcCommonAreaShare(room = null) {
var numPeople;
if (room) {
numPeople = room.numPeople;
} else {
numPeople = this.numRooms;
}
return commonArea / numPeopleTotal * numPeople;
}
// Calculates the total area the party has to pay for // Calculates the total area the party has to pay for
// Includes the private area, share of the common area and for // Includes the private area and if applicable share of
// WGs and clusters the share of the internal shared area // the internal common area of WGs and cluster flats
calcTotalPayedArea(room = null) { calcTotalPayedArea(room = null) {
var commonAreaShare = this.calcCommonAreaShare(room);
if (!room) { if (!room) {
return this.sizePrivate + commonAreaShare; return this.sizePrivate;
} else { } else {
return room.size + commonAreaShare + this.calcInternalAreaShare(room); return room.size + this.calcInternalAreaShare(room);
} }
} }
} }
@@ -129,8 +113,6 @@ const addedCost = 1.2;
export const minRent = 9.45 + addedCost; export const minRent = 9.45 + addedCost;
export const maxRent = 13.06 + addedCost; export const maxRent = 13.06 + addedCost;
const commonArea = 388.80;
// Calculate total number of people // Calculate total number of people
var _numPeople = 0; var _numPeople = 0;

View File

@@ -103,24 +103,33 @@ export function FlatDetailsCard({ flat, room }) {
var sizeSharedBox = null; var sizeSharedBox = null;
var commonAreaShare = flat.calcCommonAreaShare(room);
var internalAreaShare = flat.calcInternalAreaShare(room); var internalAreaShare = flat.calcInternalAreaShare(room);
var totalSizeToPay = flat.calcTotalPayedArea(room);
if (flat.wgRoomList.length > 0) { if (flat.wgRoomList.length > 0) {
sizeSharedBox = <Box> sizeSharedBox = [
<Heading size='xs' textTransform='uppercase'> <Box>
Interne Gemeinschaftsfläche <Heading size='xs' textTransform='uppercase'>
</Heading> Anteil Interne Gemeinschaftsfläche (WG und Cluster)
<Text pt='2' fontSize='sm'> </Heading>
{flat.sizeShared.toFixed(2)} <Text pt='2' fontSize='sm'>
</Text> {internalAreaShare.toFixed(2)}
</Box>; </Text>
</Box >,
<Box>
<Heading size='xs' textTransform='uppercase'>
Zahlfläche
</Heading>
<Text pt='2' fontSize='sm'>
{sizePrivate.toFixed(2)} + {internalAreaShare.toFixed(2)} (WG/Cluster-Fläche)
</Text>
<Text pt={3} size='s' fontWeight='bold'>Gesamt: {totalSizeToPay.toFixed(2)} </Text>
</Box>
];
} }
var totalSizeToPay = flat.calcTotalPayedArea(room);
body = <CardBody> body = <CardBody>
<Stack divider={<StackDivider />} spacing='4'> <Stack divider={<StackDivider />} spacing='4'>
@@ -135,34 +144,18 @@ export function FlatDetailsCard({ flat, room }) {
</Box> </Box>
<Box> <Box>
<Heading size='xs' textTransform='uppercase'> <Heading size='xs' textTransform='uppercase'>
Zimmeranzahl Zimmeranzahl und Gesamtfläche
</Heading> </Heading>
<Text pt='2' fontSize='sm'> <Text pt='2' fontSize='sm'>
{flat.numRooms} {flat.numRooms} Zimmer, {flat.sizePrivate.toFixed(2)}
</Text> </Text>
</Box> </Box>
{sizeSharedBox} {sizeSharedBox}
<Box>
<Heading size='xs' textTransform='uppercase'>
Anteil Gemeinschaftsfläche
</Heading>
<Text pt='2' fontSize='sm'>
{commonAreaShare.toFixed(2)} {internalAreaShare ? ("(Allmendefläche) + " + internalAreaShare.toFixed(2) + " m² (WG/Cluster-Fläche)") : ""}
</Text>
</Box>
<Box>
<Heading size='xs' textTransform='uppercase'>
Zahlfläche
</Heading>
<Text pt='2' fontSize='sm'>
{sizePrivate.toFixed(2)} + {commonAreaShare.toFixed(2)} (Allmendefläche) {internalAreaShare ? " + " + (internalAreaShare.toFixed(2) + " m² (WG/Cluster-Fläche)") : null}
</Text>
<Text pt={3} size='s' fontWeight='bold'>Gesamt: {totalSizeToPay.toFixed(2)} </Text>
</Box>
<Box> <Box>
<Heading size='xs' textTransform='uppercase'> <Heading size='xs' textTransform='uppercase'>
Mindestmiete Mindestmiete
</Heading> </Heading>
<Text fontSize="xs">Die Mindestmiete ergibt sich aus dem WBS Satz für die private Fläche (4,45 /), den Nebenkosten (1,20 /) und der Küchen-Nutzungspauschale von 50 pro Küche</Text>
<Text pt='2' fontSize='m' fontWeight='bold'> <Text pt='2' fontSize='m' fontWeight='bold'>
{((sizePrivate + internalAreaShare) * minRent + 50).toFixed(2)} {((sizePrivate + internalAreaShare) * minRent + 50).toFixed(2)}
</Text> </Text>