-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FLAG-900: Undefined year causing an error in the TCL due to Fires widget in protected and some custom area dashboards #4681
Conversation
…en calling the OTF function
…s are the source of truth when doing calculations
@@ -19,7 +19,7 @@ const SQL_QUERIES = { | |||
lossFires: | |||
'SELECT {select_location}, umd_tree_cover_loss__year, SUM(umd_tree_cover_loss__ha) AS umd_tree_cover_loss__ha, SUM(umd_tree_cover_loss_from_fires__ha) AS "umd_tree_cover_loss_from_fires__ha" FROM data {WHERE} GROUP BY umd_tree_cover_loss__year, {location} ORDER BY umd_tree_cover_loss__year, {location}', | |||
lossFiresOTF: | |||
'SELECT umd_tree_cover_loss__year, sum(umd_tree_cover_loss__ha), sum(umd_tree_cover_loss_from_fires__ha) FROM data WHERE umd_tree_cover_loss__year >= {startYear} AND umd_tree_cover_loss__year <= {endYear} AND umd_tree_cover_density_2000__threshold >= 30 GROUP BY umd_tree_cover_loss__year', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, wonder why did we have a hardcoded value here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most likely an oversight that evaded Code Review and QA. I've added my thoughts as to how it may happened to the JIRA task. I would guess that during the development of a new widget, the example SQL query we get from the data team was used directly in order to build the widget, and then we missed the fact we need to do interpolation as well.
We had a similar issue before, concerning the {startYear}
and {endYear}
addressed here.
LGTM, tested 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overview
This PR fixes the issue where the fires widget breaks when it is set to do an OTF analysis, due to missing start and year years in the settings, causing the SQL query to be misconstructed.
Notes
It also includes a minor refactoring to the data processing in an attempt to prevent such mistakes by using the widgets' settings as the source of truth, and enables the "Years" setting that seems to have been missing for a while.
Testing
Test the links from the JIRA task (linked below) on this staging environment, verify that they now work.
Tracking
FLAG-900