Skip to content

Commit

Permalink
Fix when to calculate
Browse files Browse the repository at this point in the history
  • Loading branch information
huulbaek committed Oct 25, 2023
1 parent c9a4f8d commit 27f23b9
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 33 deletions.
2 changes: 2 additions & 0 deletions src/calculations/interfaces/space_constant.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export interface ISpaceConstant {
seatPersonRoom?: string // Optional, defines the type of space: seat, person or room
shouldCalculateNumberOfRooms?: boolean // Whether to calculate the number of rooms
shouldCalculateNumberOfSeats?: boolean // Whether to calculate the number of seats
areaPerRole: number // The area required per role
personsPerType: number // The number of persons per type of space
minimumPersons?: number // The minimum number of persons for this space
Expand Down
5 changes: 2 additions & 3 deletions src/calculations/spaces/main_space_class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ export default class MainSpace implements ISpaceCalculation {
* @returns {number}
*/
calculateNumberOfRooms (): number {
// return Math.ceil(this.space.result.adjustedAreaInclCompensation! / this.spaceConstants.areaPerRole)
if (this.spaceConstants.seatPersonRoom === 'room') {
if (this.spaceConstants.shouldCalculateNumberOfRooms) {
return Math.ceil(this.space.result.adjustedAreaInclCompensation! / this.spaceConstants.minimumSquareMeters!)
}
return 0
Expand All @@ -164,7 +163,7 @@ export default class MainSpace implements ISpaceCalculation {
* @returns {number}
*/
calculateNumberOfSeats (): number {
if (this.spaceConstants.seatPersonRoom === 'seat') {
if (this.spaceConstants.shouldCalculateNumberOfSeats) {
return Math.round((this.space.result.employeesPerWorkplaceTypeAdjusted || 0) + this.#employeesPerSeatTypeInPeak())
}
return 0
Expand Down
92 changes: 62 additions & 30 deletions src/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false,
"requiresAdditionalStorage": true,
"surchargeInternalCorridorShare": 0.06
"surchargeInternalCorridorShare": 0.06,
"shouldCalculateNumberOfSeats": true
}
},
{
Expand All @@ -44,7 +45,8 @@
"countsTowardsWorkspaceArea": true,
"adhereToGovernmentMinimum": true,
"requiresAdditionalStorage": true,
"surchargeInternalCorridorShare": 0.31
"surchargeInternalCorridorShare": 0.31,
"shouldCalculateNumberOfSeats": true
}
}
]
Expand All @@ -64,7 +66,8 @@
"minimumSquareMeters": 8.0,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": true,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -80,7 +83,8 @@
"countsTowardsWorkspaceArea": true,
"adhereToGovernmentMinimum": true,
"requiresAdditionalStorage": true,
"surchargeInternalCorridorShare": 0.36
"surchargeInternalCorridorShare": 0.36,
"shouldCalculateNumberOfSeats": true
}
}
]
Expand All @@ -100,7 +104,9 @@
"minimumSquareMeters": 36.0,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": true,
"adhereToGovernmentMinimum": true
"adhereToGovernmentMinimum": true,
"shouldCalculateNumberOfRooms": true,
"shouldCalculateNumberOfSeats": true
}
}
]
Expand All @@ -121,7 +127,8 @@
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": true,
"adhereToGovernmentMinimum": false,
"requiresAdditionalStorage": true
"requiresAdditionalStorage": true,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -137,7 +144,8 @@
"countsTowardsWorkspaceArea": true,
"adhereToGovernmentMinimum": false,
"requiresAdditionalStorage": true,
"surchargeInternalCorridorShare": 0.36
"surchargeInternalCorridorShare": 0.36,
"shouldCalculateNumberOfSeats": true
}
}
]
Expand All @@ -158,7 +166,8 @@
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false,
"unitsPerPerson": 0.02
"unitsPerPerson": 0.02,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand Down Expand Up @@ -192,7 +201,8 @@
"minimumSquareMeters": 6.0,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -210,7 +220,8 @@
"minimumSquareMeters": 1.8,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -224,7 +235,8 @@
"minimumSquareMeters": 8.7,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -238,7 +250,8 @@
"minimumSquareMeters": 11.0,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -252,7 +265,8 @@
"minimumSquareMeters": 21.0,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
}
]
Expand Down Expand Up @@ -312,7 +326,8 @@
"minimumSquareMeters": 10.0,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -326,7 +341,8 @@
"minimumSquareMeters": 2.0,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
}
]
Expand Down Expand Up @@ -375,7 +391,8 @@
"unitsPerPerson": 0.067,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -390,7 +407,8 @@
"unitsPerPerson": 0.01,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
}
]
Expand Down Expand Up @@ -432,7 +450,8 @@
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false,
"requiresAdditionalStorage": true,
"surchargeInternalCorridorShare": 0.06
"surchargeInternalCorridorShare": 0.06,
"shouldCalculateNumberOfSeats": true
}
},
{
Expand All @@ -448,7 +467,8 @@
"countsTowardsWorkspaceArea": true,
"adhereToGovernmentMinimum": true,
"requiresAdditionalStorage": true,
"surchargeInternalCorridorShare": 0.31
"surchargeInternalCorridorShare": 0.31,
"shouldCalculateNumberOfSeats": true
}
}
]
Expand Down Expand Up @@ -488,7 +508,9 @@
"minimumSquareMeters": 36.0,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": true,
"adhereToGovernmentMinimum": true
"adhereToGovernmentMinimum": true,
"shouldCalculateNumberOfRooms": true,
"shouldCalculateNumberOfSeats": true
}
},
{
Expand All @@ -502,7 +524,8 @@
"minimumSquareMeters": 6.0,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -520,7 +543,8 @@
"minimumSquareMeters": 8.7,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -534,7 +558,8 @@
"minimumSquareMeters": 11.0,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -548,7 +573,8 @@
"minimumSquareMeters": 21.0,
"shouldCalculateCompensation": true,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
}
]
Expand Down Expand Up @@ -637,7 +663,8 @@
"unitsPerPerson": 0.067,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -652,7 +679,8 @@
"unitsPerPerson": 0.01,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
}
]
Expand Down Expand Up @@ -813,7 +841,8 @@
"minimumSquareMeters": 15.0,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -827,7 +856,8 @@
"minimumSquareMeters": 5.0,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
}
]
Expand All @@ -848,7 +878,8 @@
"unitsPerPerson": 0.033,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
},
{
Expand All @@ -863,7 +894,8 @@
"unitsPerPerson": 0.01,
"shouldCalculateCompensation": false,
"countsTowardsWorkspaceArea": false,
"adhereToGovernmentMinimum": false
"adhereToGovernmentMinimum": false,
"shouldCalculateNumberOfRooms": true
}
}
]
Expand Down

0 comments on commit 27f23b9

Please sign in to comment.