Skip to content

Commit

Permalink
invert logic when E5/G5
Browse files Browse the repository at this point in the history
  • Loading branch information
femshima committed Mar 2, 2024
1 parent 83d80d2 commit fd45c0d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/jlabel-question/src/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,11 @@ impl Position for BooleanPosition {

fn range(&self, ranges: &[&str]) -> Result<Self::Range, ParseError> {
let first = ranges.first().ok_or(ParseError::Empty)?;
// E5/G5's logics are inverted
let field_false = matches!(self, Self::E5 | Self::G5);
match *first {
"0" => Ok(false),
"1" => Ok(true),
"0" => Ok(field_false),
"1" => Ok(!field_false),
_ => Err(ParseError::InvalidBoolean(first.to_string())),
}
}
Expand Down

0 comments on commit fd45c0d

Please sign in to comment.