From fec53f4012b2d708cb46e78acd48cc7dc44d21b6 Mon Sep 17 00:00:00 2001 From: Antoine Anceau <252369389+antoineanceau@users.noreply.github.com> Date: Tue, 7 Jul 2026 06:56:58 +0200 Subject: [PATCH] refactor(rules): update criteria with <= operator where applicable --- rules/hsc_2000_monohull_intact.rhai | 14 ++++---------- rules/is_code_2008_complete.rhai | 2 +- rules/is_code_2008_passenger.rhai | 6 ++++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/rules/hsc_2000_monohull_intact.rhai b/rules/hsc_2000_monohull_intact.rhai index f547b9f..9b7f089 100644 --- a/rules/hsc_2000_monohull_intact.rhai +++ b/rules/hsc_2000_monohull_intact.rhai @@ -203,12 +203,9 @@ fn check(ctx) { "Equilibrium angle due to passenger crowding ≤ " + max_heel_due_to_lever.toFixed(1) + "°", max_heel_due_to_lever, angle_pass, - "°" + "°", + "<=" )); - // Actual margin should be inverted here since angle_pass must be <= max - let r_len = results.len(); - results[r_len - 1].status = if angle_pass <= max_heel_due_to_lever { "PASS" } else { "FAIL" }; - results[r_len - 1].margin = max_heel_due_to_lever - angle_pass; } else { results.push(#{ name: "Passenger Crowding Heel", @@ -226,12 +223,9 @@ fn check(ctx) { "Equilibrium angle due to wind ≤ " + max_heel_due_to_lever.toFixed(1) + "°", max_heel_due_to_lever, angle_wind, - "°" + "°", + "<=" )); - // Actual margin should be inverted - let r_len = results.len(); - results[r_len - 1].status = if angle_wind <= max_heel_due_to_lever { "PASS" } else { "FAIL" }; - results[r_len - 1].margin = max_heel_due_to_lever - angle_wind; } else { results.push(#{ name: "Wind Heeling Angle", diff --git a/rules/is_code_2008_complete.rhai b/rules/is_code_2008_complete.rhai index 98abf3b..6f5ec83 100644 --- a/rules/is_code_2008_complete.rhai +++ b/rules/is_code_2008_complete.rhai @@ -219,7 +219,7 @@ if has_wind { if phi0 != () { // Check 3.2.2.1 - results.push(criterion("3.2.2.1 Equilibrium", "Steady wind heel <= 16 deg", 16.0, phi0, "deg")); + results.push(criterion("3.2.2.1 Equilibrium", "Steady wind heel <= 16 deg", 16.0, phi0, "deg", "<=")); // 3. lw2 = 1.5 * lw1 let lw2 = 1.5 * lw1; diff --git a/rules/is_code_2008_passenger.rhai b/rules/is_code_2008_passenger.rhai index 80d7175..6e43bc6 100644 --- a/rules/is_code_2008_passenger.rhai +++ b/rules/is_code_2008_passenger.rhai @@ -61,7 +61,8 @@ fn check(ctx) { "Angle of heel due to passenger crowding", MAX_HEEL_PASSENGER, angle_pass, - "°" + "°", + "<=" )); } else { results.push(#{ @@ -86,7 +87,8 @@ fn check(ctx) { "Angle of heel due to turning", MAX_HEEL_TURNING, angle_turn, - "°" + "°", + "<=" )); } else { results.push(#{