diff --git a/app/models/position.rb b/app/models/position.rb index f19b1c80c..59c7dad58 100644 --- a/app/models/position.rb +++ b/app/models/position.rb @@ -110,7 +110,8 @@ def language_exp=(language_ids) private def find_name_fact_from_project_and_comitter_name - NameFact.joins(:name).find_by('analysis_id = ? AND names.name = ?', project.best_analysis_id, committer_name) + NameFact.joins(:name).find_by('analysis_id = ? AND lower(unaccent(names.name)) = ?', project.best_analysis_id, + ActiveSupport::Inflector.transliterate(committer_name).downcase) end def committer_name_and_project? diff --git a/db/migrate/20240724182111_add_unaccent_extension.rb b/db/migrate/20240724182111_add_unaccent_extension.rb new file mode 100644 index 000000000..ee7ec2afa --- /dev/null +++ b/db/migrate/20240724182111_add_unaccent_extension.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddUnaccentExtension < ActiveRecord::Migration[5.2] + def up + execute 'create extension unaccent;' + end + + def down + execute 'drop extension unaccent;' + end +end diff --git a/db/structure.sql b/db/structure.sql index 942ec8f03..c50bab542 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -65,6 +65,20 @@ CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA fis; COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQL statements executed'; +-- +-- Name: unaccent; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA oh; + + +-- +-- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents'; + + -- -- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: - -- @@ -5467,6 +5481,7 @@ CREATE TABLE oh.countries ( region text ); + -- -- Name: cve_bdsa; Type: TABLE; Schema: oh; Owner: - -- @@ -5496,6 +5511,7 @@ CREATE SEQUENCE oh.cve_bdsa_id_seq ALTER SEQUENCE oh.cve_bdsa_id_seq OWNED BY oh.cve_bdsa.id; + -- -- Name: deleted_accounts; Type: TABLE; Schema: oh; Owner: - -- @@ -6568,6 +6584,7 @@ CREATE TABLE oh.links_truncated ( url text ); + -- -- Name: maintenance_routes; Type: TABLE; Schema: oh; Owner: - -- @@ -6576,6 +6593,7 @@ CREATE TABLE oh.maintenance_routes ( path character varying ); + -- -- Name: manages; Type: TABLE; Schema: oh; Owner: - -- @@ -9478,12 +9496,14 @@ ALTER TABLE ONLY oh.clumps ALTER COLUMN id SET DEFAULT nextval('oh.clumps_id_seq ALTER TABLE ONLY oh.code_location_scan ALTER COLUMN id SET DEFAULT nextval('oh.code_location_scan_id_seq'::regclass); + -- -- Name: cve_bdsa id; Type: DEFAULT; Schema: oh; Owner: - -- ALTER TABLE ONLY oh.cve_bdsa ALTER COLUMN id SET DEFAULT nextval('oh.cve_bdsa_id_seq'::regclass); + -- -- Name: deleted_accounts id; Type: DEFAULT; Schema: oh; Owner: - -- @@ -10321,6 +10341,7 @@ ALTER TABLE ONLY oh.clumps ALTER TABLE ONLY oh.code_location_scan ADD CONSTRAINT code_location_scan_pkey PRIMARY KEY (id); + -- -- Name: cve_bdsa cve_bdsa_pkey; Type: CONSTRAINT; Schema: oh; Owner: - -- @@ -10328,6 +10349,7 @@ ALTER TABLE ONLY oh.code_location_scan ALTER TABLE ONLY oh.cve_bdsa ADD CONSTRAINT cve_bdsa_pkey PRIMARY KEY (id); + -- -- Name: deleted_accounts deleted_accounts_pkey; Type: CONSTRAINT; Schema: oh; Owner: - -- @@ -19281,6 +19303,8 @@ INSERT INTO oh.schema_migrations (version) VALUES ('20230801115125'); INSERT INTO oh.schema_migrations (version) VALUES ('20240305184511'); +INSERT INTO oh.schema_migrations (version) VALUES ('20240724182111'); + INSERT INTO oh.schema_migrations (version) VALUES ('21'); INSERT INTO oh.schema_migrations (version) VALUES ('22'); @@ -19452,3 +19476,4 @@ INSERT INTO oh.schema_migrations (version) VALUES ('97'); INSERT INTO oh.schema_migrations (version) VALUES ('98'); INSERT INTO oh.schema_migrations (version) VALUES ('99'); +