From 3562fb2bbb889945469aa18eee22f5f1d72ca649 Mon Sep 17 00:00:00 2001 From: EdmondFrank Date: Thu, 22 Feb 2024 15:32:22 +0800 Subject: [PATCH] Use prefix matching in contributor and organization filtering. Signed-off-by: EdmondFrank --- app/models/concerns/contributor_enrich.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/concerns/contributor_enrich.rb b/app/models/concerns/contributor_enrich.rb index 34d5f6a6..2b83b27a 100644 --- a/app/models/concerns/contributor_enrich.rb +++ b/app/models/concerns/contributor_enrich.rb @@ -87,6 +87,8 @@ def filter_contributors(contributors, filter_opts) contributors .select { |row| !(filter_opt.values & row['contribution_type_list'].map{|c| c['contribution_type']}).empty? } .map { |row| append_filtered_contribution(row, filter_opt) } + elsif filter_opt.type == 'contributor' || filter_opt.type == 'organization' + contributors.select { |row| filter_opt.values.any? { |value| row[filter_opt.type].starts_with?(value) } } else contributors.select { |row| filter_opt.values.include?(row[filter_opt.type]) } end