feat: fix line numbers
This commit is contained in:
20
src/api.rs
20
src/api.rs
@@ -199,14 +199,12 @@ pub async fn bahnhof_get_departures() -> Result<String, String> {
|
||||
o.push_str("<div>");
|
||||
}
|
||||
o.push_str("<b>");
|
||||
let line_name = if let Some(p) = &line_name.product {
|
||||
if let Some(nr) = &line_name.line_number {
|
||||
format!("{p} {nr}")
|
||||
} else {
|
||||
format!("{p}")
|
||||
}
|
||||
let line_name = if let Some(txt) = &line_name.text_medium {
|
||||
txt.as_str()
|
||||
} else if let Some(txt) = &line_name.line_number {
|
||||
txt.as_str()
|
||||
} else {
|
||||
"[?]".to_owned()
|
||||
"[?]"
|
||||
};
|
||||
html_escape::encode_safe_to_string(&line_name, &mut o);
|
||||
o.push_str("</b>");
|
||||
@@ -423,8 +421,12 @@ struct BahnhofResDeparture {
|
||||
pub struct BahnhofResDepartureDestination {
|
||||
#[serde(rename = "linienNummer")]
|
||||
pub line_number: Option<String>,
|
||||
#[serde(rename = "kurzText")]
|
||||
pub product: Option<String>,
|
||||
// #[serde(rename = "kurzText")]
|
||||
// pub text_short: Option<String>,
|
||||
#[serde(rename = "mittelText")]
|
||||
pub text_medium: Option<String>,
|
||||
// #[serde(rename = "langText")]
|
||||
// pub text_long: Option<String>,
|
||||
}
|
||||
#[derive(Deserialize)]
|
||||
pub struct BahnhofResDepartureMessage {
|
||||
|
||||
Reference in New Issue
Block a user