Resolution days now better correspond to the meaning

This commit is contained in:
Love 2025-01-08 16:25:55 +01:00
parent 1628a4b238
commit 34f40b3602
3 changed files with 7 additions and 5 deletions

4
src/cache/cache.rs vendored
View File

@ -55,7 +55,7 @@ impl Cache {
match resolution { match resolution {
Resolution::TODAY => self.day.as_ref(), Resolution::TODAY => self.day.as_ref(),
Resolution::HistDays90 => self.hist_90.as_ref(), Resolution::HistDays90 => self.hist_90.as_ref(),
Resolution::HistDay => self.hist_day.as_ref(), Resolution::HistDaysAll => self.hist_day.as_ref(),
} }
} }
@ -64,7 +64,7 @@ impl Cache {
match resolution { match resolution {
Resolution::TODAY => self.day = cache_line_opt, Resolution::TODAY => self.day = cache_line_opt,
Resolution::HistDays90 => self.hist_90 = cache_line_opt, Resolution::HistDays90 => self.hist_90 = cache_line_opt,
Resolution::HistDay => self.hist_day = cache_line_opt, Resolution::HistDaysAll => self.hist_day = cache_line_opt,
} }
} }

View File

@ -47,8 +47,10 @@ pub enum SortBy {
#[derive(Debug, Clone, Copy, ValueEnum)] #[derive(Debug, Clone, Copy, ValueEnum)]
pub enum Resolution { pub enum Resolution {
TODAY, TODAY,
#[clap(name = "hist-90-days")]
HistDays90, HistDays90,
HistDay, #[clap(name = "hist-all-days")]
HistDaysAll,
} }
impl Resolution { impl Resolution {
@ -56,7 +58,7 @@ impl Resolution {
match self { match self {
Resolution::TODAY => ecb_url::TODAY, Resolution::TODAY => ecb_url::TODAY,
Resolution::HistDays90 => ecb_url::hist::DAYS_90, Resolution::HistDays90 => ecb_url::hist::DAYS_90,
Resolution::HistDay => ecb_url::hist::DAILY, Resolution::HistDaysAll => ecb_url::hist::DAYS_ALL,
} }
} }
} }

View File

@ -11,7 +11,7 @@ pub mod ecb_url {
pub const TODAY: &'static str = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"; pub const TODAY: &'static str = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml";
pub mod hist { pub mod hist {
pub const DAILY: &'static str = pub const DAYS_ALL: &'static str =
"https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml"; "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml";
pub const DAYS_90: &'static str = pub const DAYS_90: &'static str =
"https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml"; "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml";