Skip to content

Commit

Permalink
Update the RAG table
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Aug 21, 2024
1 parent 82860d0 commit d5182a9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 32 deletions.
60 changes: 40 additions & 20 deletions pavement_parking/src/ratings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,21 @@ pub enum Rating {

impl Rating {
pub fn new(class: Class, width: f64) -> Self {
match class {
Class::A | Class::B => {
if width >= 11.8 {
Self::Green
} else if width >= 10.4 {
Self::Amber
} else {
Self::Red
}
}
// From an internal PDF, the "No parking restriction" scenario
let (desirable_min, absolute_min) = match class {
// TODO Not filled out
Class::A => (1.0, 0.0),
Class::B => (12.8, 11.5),
Class::C => (10.0, 9.1),
Class::Unclassified => (9.5, 8.4),
};

Class::C | Class::Unclassified => {
if width >= 9.0 {
Self::Green
} else if width >= 7.5 {
Self::Amber
} else {
// TODO Table doesn't handle [7, 7.5]
Self::Red
}
}
if width >= desirable_min {
Self::Green
} else if width >= absolute_min {
Self::Amber
} else {
Self::Red
}
}

Expand All @@ -41,3 +35,29 @@ impl Rating {
}
}
}

#[allow(unused)]
fn old_table(class: Class, width: f64) -> Rating {
match class {
Class::A | Class::B => {
if width >= 11.8 {
Rating::Green
} else if width >= 10.4 {
Rating::Amber
} else {
Rating::Red
}
}

Class::C | Class::Unclassified => {
if width >= 9.0 {
Rating::Green
} else if width >= 7.5 {
Rating::Amber
} else {
// TODO Table doesn't handle [7, 7.5]
Rating::Red
}
}
}
}
24 changes: 12 additions & 12 deletions pavement_parking/web/src/About.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@
</tr>
<tr>
<th style:color={colors.green}>Green</th>
<td>&ge; 11.8m</td>
<td>&ge; 11.8m</td>
<td>&ge; 9m</td>
<td>&ge; 9m</td>
<td>&ge; ???</td>
<td>&ge; 12.8m</td>
<td>&ge; 10.0m</td>
<td>&ge; 9.5m</td>
</tr>
<tr>
<th style:color={colors.amber}>Amber</th>
<td>10.4m - 11.8m</td>
<td>10.4m - 11.8m</td>
<td>7.5m - 9m</td>
<td>7.5m - 9m</td>
<td>???m - ???</td>
<td>11.5m - 12.8m</td>
<td>9.1m - 10.0m</td>
<td>8.4m - 9.5m</td>
</tr>
<tr>
<th style:color={colors.red}>Red</th>
<td>&lt; 10.4m</td>
<td>&lt; 10.4m</td>
<td>&lt; 7.5m</td>
<td>&lt; 7.5m</td>
<td>&lt; ???</td>
<td>&lt; 11.5m</td>
<td>&lt; 9.1m</td>
<td>&lt; 8.4m</td>
</tr>
</table>

Expand Down

0 comments on commit d5182a9

Please sign in to comment.