Skip to content

Commit

Permalink
Merge pull request #5283 from solgenomics/topic/disable_fuzzy_search_…
Browse files Browse the repository at this point in the history
…curator_requirement

Topic/disable fuzzy search curator requirement
  • Loading branch information
afpowell authored Feb 3, 2025
2 parents 149937a + b72040f commit 579e35c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
16 changes: 8 additions & 8 deletions lib/SGN/Controller/AJAX/Accessions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ sub verify_accession_list_POST : Args(0) {
my @organism_list = $organism_list_json ? @{_parse_list_from_json($c, $organism_list_json)} : [];

my $do_fuzzy_search = $c->req->param('do_fuzzy_search');
if ($user_role ne 'curator' && !$do_fuzzy_search) {
$c->stash->{rest} = {error=>'Only a curator can add accessions without using the fuzzy search!'};
$c->detach();
}
#if ($user_role ne 'curator' && !$do_fuzzy_search) {
# $c->stash->{rest} = {error=>'Only a curator can add accessions without using the fuzzy search!'};
# $c->detach();
#}

if ($do_fuzzy_search) {
$self->do_fuzzy_search($c, \@accession_list, \@organism_list);
Expand Down Expand Up @@ -239,10 +239,10 @@ sub verify_accessions_file_POST : Args(0) {
my $do_fuzzy_search = $user_role eq 'curator' && !$c->req->param('fuzzy_check_upload_accessions') ? 0 : 1;
my $append_synonyms = !$c->req->param('append_synonyms') ? 0 : 1;

if ($user_role ne 'curator' && !$do_fuzzy_search) {
$c->stash->{rest} = {error=>'Only a curator can add accessions without using the fuzzy search!'};
$c->detach();
}
#if ($user_role ne 'curator' && !$do_fuzzy_search) {
# $c->stash->{rest} = {error=>'Only a curator can add accessions without using the fuzzy search!'};
# $c->detach();
#}

# These roles are required by CXGN::UploadFile
if ($user_role ne 'curator' && $user_role ne 'submitter' && $user_role ne 'sequencer' ) {
Expand Down
22 changes: 11 additions & 11 deletions mason/breeders_toolbox/add_accessions_dialogs.mas
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ $editable_stock_props_definitions
<div class="form-group">
<label class="col-sm-4 control-label">Use Fuzzy Search: </label>
<div class="col-sm-8">
% if ( $user_role eq 'curator' ) {
<input type="checkbox" id="fuzzy_check" name="fuzzy_check" checked></input>
% } else {
<input type="checkbox" id="fuzzy_check" name="fuzzy_check" checked disabled></input>
% }
%# if ( $user_role eq 'curator' ) {
<input type="checkbox" id="fuzzy_check" name="fuzzy_check"></input>
%# } else {
%# <input type="checkbox" id="fuzzy_check" name="fuzzy_check" checked disabled></input>
%# }
<br/>
<small>Note: Use the fuzzy search to match similar names to prevent uploading of duplicate accessions. Fuzzy searching is much slower than regular search. Only a curator can disable the fuzzy search.</small>
<small>Note: Use the fuzzy search to match similar names to prevent uploading of duplicate accessions. Fuzzy searching is much slower than regular search. </small>
</div>
</div>
</form>
Expand Down Expand Up @@ -87,11 +87,11 @@ $editable_stock_props_definitions
<div class="form-group">
<label class="col-sm-4 control-label">Use Fuzzy Search: </label>
<div class="col-sm-8">
% if ( $user_role eq 'curator' ) {
<input type="checkbox" id="fuzzy_check_upload_accessions" name="fuzzy_check_upload_accessions" checked></input>
% } else {
<input type="checkbox" id="fuzzy_check_upload_accessions" name="fuzzy_check_upload_accessions" checked disabled></input>
% }
%# if ( $user_role eq 'curator' ) {
<input type="checkbox" id="fuzzy_check_upload_accessions" name="fuzzy_check_upload_accessions"></input>
%# } else {
%# <input type="checkbox" id="fuzzy_check_upload_accessions" name="fuzzy_check_upload_accessions" checked disabled></input>
%# }
<br/>
<small>Note: Use the fuzzy search to match similar names to prevent uploading of duplicate accessions. Fuzzy searching is much slower than regular search. Only a curator can disable the fuzzy search.</small>
</div>
Expand Down
9 changes: 6 additions & 3 deletions t/selenium2/breeders/accessions.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

use strict;

use lib 't/lib';

use Test::More 'tests' => 48;
use Test::More 'tests' => 46;

use SGN::Test::WWW::WebDriver;
use Selenium::Remote::WDKeys 'KEYS';
Expand Down Expand Up @@ -169,8 +172,8 @@ $t->while_logged_in_as("submitter", sub {
$t->find_element_ok("add_accessions_link", "name", "find element add accessions link as submitter")->click();

my $fuzzy_checkbox = $t->find_element_ok("fuzzy_check", "id", "find fuzzy checkbox");
is $fuzzy_checkbox->get_attribute('checked'), 1, 'fuzzy logic checkbox is checked for submitter';
is $fuzzy_checkbox->get_attribute('disabled'), 1, 'fuzzy logic checkbox is disabled for submitter';
# is $fuzzy_checkbox->get_attribute('checked'), 1, 'fuzzy logic checkbox is checked for submitter';
# is $fuzzy_checkbox->get_attribute('disabled'), 1, 'fuzzy logic checkbox is disabled for submitter';
});

$t->driver->close();
Expand Down

0 comments on commit 579e35c

Please sign in to comment.