geopython / geopython/GeoHealthCheck
Last_run in list_resources view is effectively the first run
- Dominant language
- Python
- Stars
- 92
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Description
When trying to come up with a fix for issue #326, I noticed some code in which all kinds of info about resources is gathered in a loop. In this code the first and last runs of all (filtered) resources is determined as well. However, I've noticed that the comparison operator is "less than" in both cased.
See the following code in views.py, function `list_resources`:
```py
for resource in response['resources']:
if resource.run_count > 0:
# View should work even without Runs
if first_run is None or resource.first_run < first_run:
first_run = resource.first_run
if last_run is None or resource.last_run < last_run:
last_run = resource.last_run
response['first_run'] = first_run
```
I've also noticed that, although first_run and last_run are stored in the response object, they don't appear to be used anywhere. This might also be the case for other variables collected in `list_resources` and other functions. Cleaning this up should also improve the performance, as reported in issue #326.
Contributor guide
Assessment
This issue has not been assessed yet.