TheLens / contracts

An archive of contracts and other documents from the City of New Orleans.
http://vault.thelensnola.org/contracts/
0 stars 0 forks source link

autofill names of vendors #8

Open AbeHandler opened 9 years ago

AbeHandler commented 9 years ago

There are way too many vendors in the search box. @ThomasThoren I can help you set up autofill as a way to get you more familiar with the contracts code.

AbeHandler commented 9 years ago

This one is more complex than it looks. Some vendors are lower case, others are upper case. This is leading to headaches. I think the thing to do is probably to just standardize vendor names to be all caps.

contracts=# select * from vendors where name='jeffrey rouse md'; id | name
----+------------------ 75 | jeffrey rouse md (1 row)

contracts=# select * from vendors where name='JEFFREY ROUSE MD'; id | name
-------+------------------ 17061 | JEFFREY ROUSE MD (1 row)

AbeHandler commented 9 years ago

This is arising from links with business filings.

 delete from vendors where vendors.id not in  (select vendors.id from vendors inner join contracts on vendors.id=contracts.vendorid);

ERROR: update or delete on table "vendors" violates foreign key constraint "vendorsofficers_vendorid_fkey" on table "vendorsofficers" DETAIL: Key (id)=(33) is still referenced from table "vendorsofficers". contracts=# delete from vendors where vendors.id not in (select vendors.id from vendors inner join contracts on vendors.id=contracts.vendorid);

ThomasThoren commented 9 years ago

If you already have names in the proper title case, then I'd say keep them that way for presentation. We can worry about matching search queries with database fields by converting them all to upper or lowercase.

http://stackoverflow.com/questions/7005302/postgresql-how-to-make-not-case-sensitive-queries