Skip to content

Commit

Permalink
Fix build of bandata.rs bin
Browse files Browse the repository at this point in the history
  • Loading branch information
ollej committed Feb 20, 2025
1 parent eb99514 commit a3ef88d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-aquarium"
version = "0.20.0"
version = "0.21.0"
authors = ["Olle Wreede <[email protected]>"]
edition = "2024"
default-run = "rusty-aquarium"
Expand Down
11 changes: 5 additions & 6 deletions src/bin/bandata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct InputData {
}

#[derive(Clone, DeJson)]
#[allow(non_snake_case)]
pub struct Bandata {
pub boardings: Option<u32>,
pub alightings: Option<u32>,
Expand Down Expand Up @@ -57,12 +58,10 @@ impl From<&Option<NaiveDateTime>> for DateTimeProxy {
}
}

impl From<&DateTimeProxy> for Option<NaiveDateTime> {
fn from(date: &DateTimeProxy) -> Option<NaiveDateTime> {
match NaiveDateTime::parse_from_str(date.as_str(), "%Y-%m-%d %H:%M:%S") {
Ok(d) => Some(d),
Err(_) => None,
}
impl From<&DateTimeProxy> for NaiveDateTime {
fn from(date: &DateTimeProxy) -> NaiveDateTime {
NaiveDateTime::parse_from_str(date.as_str(), "%Y-%m-%d %H:%M:%S")
.unwrap_or(NaiveDateTime::UNIX_EPOCH)
}
}

Expand Down

0 comments on commit a3ef88d

Please sign in to comment.