Hot Fix for Backwards Compatibility of Downloadable Spreadsheet#639
Merged
Conversation
Co-authored-by: Copilot <[email protected]>
Hot Fix: Backwards compatibility for results download spreadsheet
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a backwards compatibility issue with the downloadable spreadsheet by ensuring that values of type None are handled correctly when performing arithmetic fixes. The changes include:
- Modifying the safe_get helper to return 0 for None values.
- Updating key references in the custom table configurations to use the new "Financial" field names.
- Patching deployment YAML configuration by quoting the maxSurge value for consistency.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| reoptjl/custom_table_helpers.py | Updated safe_get to handle None values explicitly. |
| reoptjl/custom_table_config.py | Updated key references from CHP to Financial for cost calculations. |
| CHANGELOG.md | Updated release notes to reflect the hot fix. |
| .helm/values.production.yaml | Corrected YAML formatting by quoting maxSurge value. |
Comments suppressed due to low confidence (1)
.helm/values.production.yaml:16
- Changing maxSurge to a quoted string ensures proper YAML parsing, but please verify that downstream deployment scripts expect this field as a string to avoid potential issues.
maxSurge: "0%"
|
|
||
| def safe_get(df: Dict[str, Any], key: str, default: Any = 0) -> Any: | ||
| return df.get(key, default) No newline at end of file | ||
| """Safely get a value from a dictionary with a default fallback.""" |
There was a problem hiding this comment.
The updated safe_get function now forces a return value of 0 when a key exists with a None value or when default is None. It would be helpful to update the docstring to clearly explain that None is automatically converted to 0 to avoid unintended behavior.
Suggested change
| """Safely get a value from a dictionary with a default fallback.""" | |
| """ | |
| Safely get a value from a dictionary with a default fallback. | |
| If the key exists in the dictionary with a value of None, or if the default | |
| value is explicitly set to None, the function will return 0. This ensures | |
| that None values are always converted to 0. | |
| Args: | |
| df (Dict[str, Any]): The dictionary to retrieve the value from. | |
| key (str): The key to look up in the dictionary. | |
| default (Any, optional): The default value to return if the key is not found. | |
| Defaults to 0. If set to None, it will be treated as 0. | |
| Returns: | |
| Any: The value associated with the key, or the default value (converted to 0 if None). | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PRs: