cityofaustin / atd-moped

A comprehensive mobility project tracking platform for Austin, Texas.
https://mobility.austin.gov/moped/
4 stars 3 forks source link

Add audit and council district triggers to feature_school_beacons table #1427

Closed chiaberry closed 1 month ago

chiaberry commented 1 month ago

Associated issues

https://github.com/cityofaustin/atd-data-tech/issues/19105

Testing

local because of db changes, use a copy of production

Steps to test:

  1. To test update audit fields with dynamic parent table name, find a project updated a while back. Add a school beacon to the map. Save. Check that your project is now top of the list on the project list view, or run this to confirm the updated at time has changed
select project_id, project_name, updated_at from project_list_view plv where plv.project_id = [your id]
  1. To test set_updated_at(), open the beacon you added in step one, and update the description. Look at the school beacons table, and you will see your beacon has an updated_at timestamp. Since there are so few beacons, I find it enough to just check the table:

    select * from feature_school_beacons
  2. To test council district, put a beacon in a district that you recognize. (the beacon at 1903 Ohlen road for example is in district 4). You will not see the council district updated on the summary page, that will be handled in a future PR. But you can see the council district here:

select fcd.id, council_district_id, fsb.beacon_name, mpc.project_id from features_council_districts fcd 
left join feature_school_beacons fsb on fcd.feature_id  = fsb.id
left join moped_proj_components mpc on mpc.project_component_id = fsb.component_id
where mpc.project_id = [your project]
  1. After you have done your changes above, you can see the activity log event invocations in the console: http://localhost:9695/console/events/data/activity_log_feature_school_beacons/logs The entries on the activity tab are sourced from the moped proj components table.

Ship list