Skip to content

Commit

Permalink
Merge pull request #1151 from bcgov/feature/ALCS-821
Browse files Browse the repository at this point in the history
ETL Populate Fill duration columns
  • Loading branch information
lstod authored Nov 9, 2023
2 parents 5a83236 + 5d46ecf commit 3248aab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ def get_insert_query_for_soil():
soil_to_remove_maximum_depth,
soil_to_remove_average_depth,
soil_project_duration_amount,
fill_project_duration_amount,
soil_project_duration_unit,
fill_project_duration_unit,
soil_fill_type_to_place,
soil_alternative_measures,
soil_to_place_volume,
Expand All @@ -268,8 +270,10 @@ def get_insert_query_for_soil():
%(remove_area)s,
%(max_remove_depth)s,
%(max_remove_depth)s,
%(duration)s,
%(remove_duration)s,
%(fill_duration)s,
%(remove_duration_unit)s,
%(fill_duration_unit)s,
%(fill_type)s,
%(alternative_measures_desc)s,
%(total_fill)s,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def dict_fill_insert(soil_dict, app_component_id, row):
soil_dict[app_component_id]["total_fill"] = row[SoilProperties.VOLUME]
soil_dict[app_component_id]["max_fill_depth"] = row[SoilProperties.DEPTH]
soil_dict[app_component_id]["fill_duration"] = row[SoilProperties.DURATION]
soil_dict[app_component_id]["duration"] = row[SoilProperties.DURATION]
soil_dict[app_component_id]["fill_area"] = row[SoilProperties.AREA]
soil_dict[app_component_id]["import_fill"] = True
soil_dict[app_component_id]["alternative_measures_desc"] = row[
Expand All @@ -156,7 +155,6 @@ def dict_rmv_insert(soil_dict, app_component_id, row):
soil_dict[app_component_id]["max_remove_depth"] = row[SoilProperties.DEPTH]
soil_dict[app_component_id]["total_remove"] = row[SoilProperties.VOLUME]
soil_dict[app_component_id]["remove_duration"] = row[SoilProperties.DURATION]
soil_dict[app_component_id]["duration"] = row[SoilProperties.DURATION]
soil_dict[app_component_id]["remove_area"] = row[SoilProperties.AREA]
soil_dict[app_component_id][SoilAction.RMV.name] = True
return
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def process_alcs_notice_of_intent_soil_fields(conn=None, batch_size=BATCH_UPLOAD
successful_updates_count = (
successful_updates_count + records_to_be_updated_count
)
last_soil_change_element_id = dict(rows[-1])["soil_change_element_id"]
last_soil_change_element_id = dict(rows[-1])[
"soil_change_element_id"
]

logger.debug(
f"Retrieved/updated items count: {records_to_be_updated_count}; total successfully updated notice of intents so far {successful_updates_count}; last updated alr_application_id: {last_soil_change_element_id}"
Expand Down Expand Up @@ -106,8 +108,8 @@ def _update_fee_fields_records(conn, batch_size, cursor, rows):
, soil_to_place_maximum_depth = %(depth)s
, soil_to_place_average_depth = %(depth)s
, soil_fill_type_to_place = %(type)s
, soil_project_duration_amount = %(project_duration)s
, soil_project_duration_unit = CASE WHEN %(project_duration)s is NOT NULL THEN 'months' ELSE NULL END
, fill_project_duration_amount = %(project_duration)s
, fill_project_duration_unit = CASE WHEN %(project_duration)s is NOT NULL THEN 'months' ELSE NULL END
, soil_already_placed_volume = 0
, soil_already_placed_area = 0
, soil_already_placed_maximum_depth = 0
Expand Down

0 comments on commit 3248aab

Please sign in to comment.