Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions data-tool/flows/tombstone/tombstone_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,12 @@ def get_filings_query(corp_num):
left outer join payment p on p.event_id = e.event_id
left outer join conv_ledger cl on cl.event_id = e.event_id
left outer join conv_event ce on e.event_id = ce.event_id
left outer join corp_name cn_old on e.event_id = cn_old.end_event_id and cn_old.corp_name_typ_cd in ('CO', 'NB')
left outer join corp_name cn_new on e.event_id = cn_new.start_event_id and cn_new.corp_name_typ_cd in ('CO', 'NB')
left outer join corp_name cn_old on e.event_id = cn_old.end_event_id
left outer join corp_name cn_new on e.event_id = cn_new.start_event_id
left outer join cont_out co on co.start_event_id = e.event_id
where 1 = 1
and e.corp_num = '{corp_num}'
and not (cn_old.corp_name is null AND cn_new.corp_name is not null and cn_new.corp_name_typ_cd in ('CO', 'NB'))
Comment on lines -710 to +715
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this works.

I just tested this code locally and I still see the conversion name change for name change type NO being migrated into the filings table.

local testing results:
Image

I think the solution should be:

  1. Keep the left outer joins as is. i.e continue filtering on ('CO', 'NB')
  2. Add the where clause ofand not (e.event_type_cd = 'CONVNC' and cn_old.corp_name is null and cn_new.corp_name is null). I think this should work because the joins where name types that are not CO or NB will now be null. I haven't tested this so you'll need to see if it works.

-- and e.corp_num = 'BC0068889'
-- and e.corp_num = 'BC0449924' -- AR, ADCORP
-- and e.trigger_dts is not null
Expand Down