File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -40,15 +40,14 @@ function dateEqual(first: Readonly<Date>, second: Readonly<Date>): boolean {
4040
4141function getCurrentSettings ( ctx : MyContext ) : Readonly < { mensa ?: string ; date : Date } > {
4242 let date = ctx . session . mensa ?. date ?? Date . now ( ) ;
43- let mensa = ctx . session . mensa ?. mensa ;
44-
45- const now = Date . now ( ) ;
46- // When that date is more than a day ago, update it
47- if ( ! mensa || ( now - date ) > DAY_IN_MS ) {
43+ const ago = Date . now ( ) - date ;
44+ // When that date is more than a day ago, forget the session settings
45+ if ( ago > DAY_IN_MS ) {
4846 date = Date . now ( ) ;
49- mensa = ctx . userconfig . mine . mensa . main ;
47+ delete ctx . session . mensa ;
5048 }
5149
50+ const mensa = ctx . session . mensa ?. mensa ?? ctx . userconfig . mine . mensa . main ;
5251 return { mensa, date : new Date ( date ) } ;
5352}
5453
You can’t perform that action at this time.
0 commit comments