ticker-serve: make upcoming_days configurable
This commit is contained in:
parent
ea7ad34b9b
commit
b0eed0dc4b
|
@ -15,6 +15,7 @@ pub struct Config {
|
|||
pub calendars: BTreeMap<String, CalendarOptions>,
|
||||
pub weekdays: Vec<String>,
|
||||
pub months: Vec<String>,
|
||||
pub upcoming_days: u32,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
|
|
@ -17,6 +17,7 @@ let
|
|||
"Mai" "Juni" "Juli" "August"
|
||||
"September" "Oktober" "November" "Dezember"
|
||||
];
|
||||
upcoming_days = 28;
|
||||
};
|
||||
tickerConfig = defaultTickerConfig // cfg.config;
|
||||
configFile = pkgs.writeText "config.yaml" (lib.generators.toYAML {} tickerConfig);
|
||||
|
|
|
@ -57,7 +57,7 @@ fn render_index(app_state: &AppState) -> String {
|
|||
let db = app_state.db.lock().unwrap();
|
||||
let today = Local::today().naive_local().and_hms(0, 0, 0);
|
||||
let limit = Local::today().naive_local().and_hms(0, 0, 0) +
|
||||
Duration::weeks(2);
|
||||
Duration::days(app_state.config.upcoming_days.into());
|
||||
let es = events
|
||||
.filter(schema::events::dtend.ge(&today))
|
||||
.or_filter(schema::events::dtstart.ge(&today))
|
||||
|
|
Loading…
Reference in New Issue