CUAHSI / CUAHSI/SWOT-Data-Viewer
Fix CSV filename dates to reflect the user's requested observation range
- Dominant language
- JavaScript
- Stars
- 5
- Forks
- 1
- Avg merge
- 1d 1m
- Merged PRs (30d)
- 2
Description
**Describe the bug**
The dates currently included in CSV filenames represent the API request boundaries rather than the first and last observation dates requested by the user. For example, the current file name may contain dates that do not align with the date range selected in the app. There are already TODO comments in the source code related to this behavior (https://github.com/CUAHSI/SWOT-Data-Viewer/blob/develop/frontend/src/_helpers/hydroCron.js).
HydroCron is currently not directly connected to the date range selected by users. In our current code, the end date is computed as the current date plus seven days. This offset seems to be related to cache duration, although I'm unsure if it is needed at all. Cache duration should be handled independently from the user's requested time range. This should not cause the dates displayed in the filename to differ from the date range selected by users.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to (https://swotviz.cuahsi.io)
2. Click on a river
3. Create a plot for a date range of interest
4. Download the data.
5. Compare the dates in the filename with the dates used when creating the plot.
**Expected behavior**
Dates in the filenames should correspond to user's requested start and end dates rather than API/cache request boundaries.
`____.csv`
The API/cache implementation may continue to use whatever boundaries are necessary internally, but those details should not be reflected in the filename.
Remove/update the relevant TODO comments for this behavior.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in frontend/src/_helpers/hydroCron.js, especially the existing TODO comments and the code that computes the API request dates. Reproduce the river plot and CSV download for a selected range, then trace where the filename is assembled. Done means the filename uses the requested start and end dates, regardless of internal API or cache boundaries, and the relevant TODO comments are updated or removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100