Class: Item::Materials::Checks::EngineeringAlert

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/item/materials/checks/engineering_alert.rb

Overview

Engineering-specific alerts for room configuration validation.
These alerts surface important information for engineers designing installation plans.

Defined Under Namespace

Classes: Result

Constant Summary collapse

AREA_OVERAGE_TOLERANCE =

Area overage tolerance.

1.05
MIN_COVERAGE_PERCENT =

Minimum coverage percent.

70
LARGE_BREAKER_AMPS_THRESHOLD =

Threshold for large breaker amps.

30

Instance Method Summary collapse

Instance Method Details

#process(container:, options: {}) ⇒ Result

Returns status and any material alerts.

Parameters:

  • container (Quote, Order, RoomConfiguration)

    the resource to check

  • options (Hash) (defaults to: {})

    shared check options passed by Item::Materials::Check

Options Hash (options:):

  • :for_www (Boolean)

    whether the check runs for the public site

  • :for_cart (Boolean)

    whether the check runs for the cart

Returns:

  • (Result)

    status and any material alerts



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/services/item/materials/checks/engineering_alert.rb', line 27

def process(container:, options: {})
  return Result.new(status: :skipped) unless qualify?(container)

  material_alerts = []

  check_requested_vs_designed_voltage(material_alerts, container, options)
  check_requested_vs_designed_cable_spacing(material_alerts, container, options)
  check_mixed_heating_element_voltages(material_alerts, container, options)
  check_heating_elements_exceed_room_area(material_alerts, container, options)
  check_low_coverage_percentage(material_alerts, container, options)
  check_heat_loss_exceeds_supply(material_alerts, container, options)
  check_missing_expansion_joint_spacing(material_alerts, container, options)
  check_large_breaker_requirements(material_alerts, container, options)

  Result.new(status: :ok, alerts: material_alerts)
end

#qualify?(container) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/services/item/materials/checks/engineering_alert.rb', line 18

def qualify?(container)
  container.is_a?(RoomConfiguration)
end