Skip to main content

Adding ShipmentLineItem records to the 400ng table (tariff400ng_items)

Update the 400ng Common Item Code List

  • Check if the "Service Code (L705)" is present in the spreadsheet
  • If the Service Code the you want to add the 400ng table isn't in this spreadsheet you will have to add it there.
  • If there is a reason that the item is not already present and you are having to add it there yourself, add a Google docs comment to the spreadsheet addressing why the new item is being added.

Update the table tariff400ng_items and the appropriate rate tables

  • Gather the information needed, the information should be in the 400ng Common Item Code List if it's not there you will need to add it there.
  • Reach out to the #dp3-ask-the-govies Slack channel and get the information needed, if you do not already have it
  • Add the new and/or updated item to the database table (tariff400ng_items) and the rate table(s)

Check that the information isn't already in the table

E.g, Query for the tariff400ng_items.code

Add or update the record

  • And the record to the database

  • (optional) If you are copying from a very similar record you can use the INSERT INTO, SELECT command via command line E.g.

      -- Example adding 105C into the table while copying from 105A
    INSERT INTO tariff400ng_items
    (code, discount_type, allowed_location, item, measurement_unit_1, created_at, updated_at)
    SELECT '105C', discount_type, 'DESTINATION', 'Full Unpack', measurement_unit_1, NOW(), NOW()
    FROM tariff400ng_items
    WHERE code = '105A';

This basically is overkill (in this scenario) since there was only 1 column copied into the new record.

  • (optional) Or copy and paste row inside your Postgres editor of choice, changing the necessary rows

Create the migration

Source code

  • For an HHG (Household Goods) move, the function that computes and creates shipment line items is ComputeShipment
  • For a PPM (Personally Procured Move) move, the function that computes and creates shipment line items is computePPM