|
|
|
@ -2119,7 +2119,7 @@ async def bulk_update_equipment(
|
|
|
|
case_mappings = {asset.location_tag: asset.is_included for asset in selected_equipments}
|
|
|
|
case_mappings = {asset.location_tag: asset.is_included for asset in selected_equipments}
|
|
|
|
|
|
|
|
|
|
|
|
# Get all assetnums that need to be updated
|
|
|
|
# Get all assetnums that need to be updated
|
|
|
|
assetnums = list(case_mappings.keys())
|
|
|
|
location_tags = list(case_mappings.keys())
|
|
|
|
|
|
|
|
|
|
|
|
# Create a list of when clauses for the case statement
|
|
|
|
# Create a list of when clauses for the case statement
|
|
|
|
when_clauses = [
|
|
|
|
when_clauses = [
|
|
|
|
@ -2131,7 +2131,7 @@ async def bulk_update_equipment(
|
|
|
|
stmt = (
|
|
|
|
stmt = (
|
|
|
|
update(CalculationEquipmentResult)
|
|
|
|
update(CalculationEquipmentResult)
|
|
|
|
.where(CalculationEquipmentResult.calculation_data_id == calculation_data_id)
|
|
|
|
.where(CalculationEquipmentResult.calculation_data_id == calculation_data_id)
|
|
|
|
.where(CalculationEquipmentResult.assetnum.in_(assetnums))
|
|
|
|
.where(CalculationEquipmentResult.location_tag.in_(location_tags))
|
|
|
|
.values(
|
|
|
|
.values(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"is_included": case(
|
|
|
|
"is_included": case(
|
|
|
|
@ -2144,4 +2144,4 @@ async def bulk_update_equipment(
|
|
|
|
await db.execute(stmt)
|
|
|
|
await db.execute(stmt)
|
|
|
|
await db.commit()
|
|
|
|
await db.commit()
|
|
|
|
|
|
|
|
|
|
|
|
return assetnums
|
|
|
|
return location_tags
|
|
|
|
|