feat: Finalizes room-pressure view.

This commit is contained in:
2025-03-01 11:46:47 -05:00
parent 5630820575
commit eaf0387899
8 changed files with 108 additions and 35 deletions

View File

@@ -68,17 +68,20 @@ public enum RoomPressure {
public struct Response: Codable, Equatable, Sendable {
public let mode: Mode
public let grilleSize: GrilleSize
public let ductSize: DuctSize
public let calculatedAirflow: Double?
public let warnings: [String]
public init(
mode: Mode,
grilleSize: RoomPressure.Response.GrilleSize,
ductSize: RoomPressure.Response.DuctSize,
calculatedAirflow: Double? = nil,
warnings: [String]
) {
self.mode = mode
self.grilleSize = grilleSize
self.ductSize = ductSize
self.calculatedAirflow = calculatedAirflow
@@ -124,3 +127,16 @@ public enum RoomPressure {
public var label: String { "\(rawValue)\"" }
}
}
#if DEBUG
public extension RoomPressure.Response {
static let mock = Self(
mode: .knownAirflow,
grilleSize: .init(width: 14, height: 8, area: 72),
ductSize: .init(diameter: 10, velocity: 367),
warnings: [
"Duct leakage area is significant - consider reducing gaps or increasing grille size."
]
)
}
#endif

View File

@@ -186,7 +186,7 @@ public extension SiteRoute {
Path { rootPath }
Method.get
Query {
Optionally { Field("form") { Routes.RoomPressure.Mode.parser() } }
Optionally { Field("mode") { Routes.RoomPressure.Mode.parser() } }
}
}
Route(.case(Self.submit)) {