CDA-120: TS and Loc Group ignore_missing flag support#195
Conversation
…g for ignore_missing flag in progress.
…ry methods for non-failing operations
e1bf406 to
7f6b9d5
Compare
| * @param p_ignore_missing Whether to fail on location assignments for locations that are not in the database | ||
| * @param p_missing_locations A list of locations that are not in the database and were not assigned to the group | ||
| */ | ||
| PROCEDURE assign_loc_groups4 (p_loc_category_id IN VARCHAR2, |
There was a problem hiding this comment.
rename procedure to something more informative. maybe assign_loc_groups_supports_missing
There was a problem hiding this comment.
Renamed as suggested
| p_missing_locations (p_missing_locations.COUNT) := | ||
| p_loc_alias_array (i); | ||
| ELSE | ||
| cwms_err.raise('LOCATION_ID_NOT_FOUND', p_loc_alias_array (i).location_id); |
There was a problem hiding this comment.
This fails immediately on the first missing location. That might be okay if that is expected behavior. Alternatively - you could always just add to the missing loc collection instead of failing early, then check if its non-empty at the end and raise an error reporting back everything that was missing.
There was a problem hiding this comment.
It appears the ts group procedure collects up the missing and reports it in the error. I would do the same here for consistency and to provide more insight to the caller.
There was a problem hiding this comment.
Updated procedure to have the same error reporting behavior
| * @param p_ignore_missing A flag ('T' or 'F') that specifies whether to ignore time series assignments that are not in the database | ||
| * @param p_missing_ts The time series identifiers for any assignments that are not in the database. | ||
| */ | ||
| PROCEDURE assign_ts_groups2 (p_ts_category_id IN VARCHAR2, |
There was a problem hiding this comment.
prefer procedure names that describe their purpose or behavior rather than appending numeric suffixes like 2 (even though that is done in alot of the plsql codebase)
| l_error_message := l_error_message || ', ' || p_missing_ts(j).ts_id; | ||
| END IF; | ||
| END LOOP; | ||
| cwms_err.raise ('ITEM_DOES_NOT_EXIST', |
There was a problem hiding this comment.
This is the behavior i would have expected for locations where we collect up the missing and report it in the error message.
There was a problem hiding this comment.
Added similar logic to location procedure
| procedure test_assign_ts_ignore_missing; | ||
|
|
||
| --%test (Test TS group assignment with ignore missing flag set to false) | ||
| --%throws(-20001) |
There was a problem hiding this comment.
This checks the error code is thrown... should also be able to get the error message and verify it contains the list of missing
There was a problem hiding this comment.
Updated to check error message
Includes new procedures for TS group and Location group assignment with
ignore_missingflag.Contributes to USACE/cwms-data-api#1731