Fix validator bug where list_of_list conversion didn't capture inner list type#308
Merged
Conversation
there was no bug caused by it being a float field, I'm just changing for correctness
validator was trying to convert to list of list again right after it failed, but without considering the inner list type
NLaws
reviewed
Mar 10, 2022
| chp_does_not_reduce_demand_charges = models.BooleanField(null=True, blank=True) | ||
| emissions_region = models.TextField(null=True, blank=True) | ||
| coincident_peak_load_active_timesteps = ArrayField(ArrayField(models.FloatField(null=True, blank=True), null=True, default=list), null=True, default=list) | ||
| coincident_peak_load_active_timesteps = ArrayField(ArrayField(models.IntegerField(null=True, blank=True), null=True, default=list), null=True, default=list) |
Member
There was a problem hiding this comment.
does this change require a migration?
NLaws
approved these changes
Mar 10, 2022
Member
NLaws
left a comment
There was a problem hiding this comment.
Looks good. I just have the question about needing a database migration for the type change in models.py. Please test deployment on testranch.
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.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
(Bug fix, feature, docs update, ...)
bug fix
What is the current behavior?
(You can also link to an open issue here)
When a 2D list was provided for coincident_peak_load_active_timesteps, and it had float values in it that were invalid time steps (e.g 1.2), the validator would not return an error. In the JuMP model, the floats would be used as indices and result in a REoptFailedToStart error for the user. When a 2D list provided had float values but they were integers in float form (e.g. 1.0), the validator would not convert these to integers, resulting also in a REoptFailedToStart error.
What is the new behavior (if this is a feature change)?
Any time float values are provided in coincident_peak_load_active_timesteps, the validator converts them to integers if possible otherwise gives the input error "Could not convert coincident_peak_load_active_timesteps () in Scenario>Site>ElectricTariff to one of int,list_of_int,list_of_list"
Does this PR introduce a breaking change?
(What changes might users need to make in their application due to this PR?)
no
Other information: