fix: restore resolution-specific date windows in SEO export script
Browse files
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
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|