alexdum commited on
Commit
63efaec
·
1 Parent(s): d4bfb31

fix: restore resolution-specific date windows in SEO export script

Browse files
Files changed (1) hide show
  1. scripts/export_seo_metadata.R +10 -5
scripts/export_seo_metadata.R CHANGED
@@ -150,11 +150,16 @@ for (rc in resolution_config) {
150
  state_counts[[state_key]]$stationCount <-
151
  state_counts[[state_key]]$stationCount + 1L
152
 
153
- # Determine the UI's default date range
154
- # Must match global.R: default_start_date <- default_end_date - (365 * 6)
155
- # The Shiny app always starts with this 6-year window regardless of resolution.
156
- # Resolution-specific adjustments only happen after user interaction.
157
- default_start_date <- Sys.Date() - (365 * 6)
 
 
 
 
 
158
  default_start_num <- as.numeric(format(default_start_date, "%Y%m%d"))
159
  default_end_num <- as.numeric(format(Sys.Date(), "%Y%m%d"))
160
 
 
150
  state_counts[[state_key]]$stationCount <-
151
  state_counts[[state_key]]$stationCount + 1L
152
 
153
+ # Determine the UI's default date range start for this resolution
154
+ # Must match server.R URL param handler for initial load
155
+ default_start_date <- switch(rc$key,
156
+ "10_minutes" = Sys.Date() - 30,
157
+ "hourly" = Sys.Date() - 366,
158
+ "monthly" = Sys.Date() - (365 * 6),
159
+ "daily" = Sys.Date() - (365 * 6),
160
+ "annual" = as.Date("1991-01-01"),
161
+ Sys.Date() - (365 * 6)
162
+ )
163
  default_start_num <- as.numeric(format(default_start_date, "%Y%m%d"))
164
  default_end_num <- as.numeric(format(Sys.Date(), "%Y%m%d"))
165