From 50a30cbdc96100c53d84667c70dfe57eed3d7c29 Mon Sep 17 00:00:00 2001 From: "Ziwen@miniserver" Date: Wed, 29 Jul 2020 23:39:25 +0200 Subject: [PATCH] Little corrections. --- backend/php/FilterClause.php | 14 +++++++------- src/app/search/search.component.ts | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/backend/php/FilterClause.php b/backend/php/FilterClause.php index 9ca28ae..e07baa4 100644 --- a/backend/php/FilterClause.php +++ b/backend/php/FilterClause.php @@ -18,7 +18,7 @@ 'NODENAME' => ['(NODELIST LIKE :node1 OR CPULIST LIKE :node2)', [':node1', ':node2']], - 'TAGS' => ['TAGS = :tag0', '( TAGS & :tag0 ) = :tag0', '( TAGS & :tag1 ) = :tag1', '( TAGS & :tag2 ) = :tag2', '( TAGS & :tag3 ) = :tag3', '( TAGS & :tag4 ) = :tag4', [':tag0', ':tag1', ':tag2', ':tag3', ':tag4']], + 'TAGS' => ['TAGS = :tag0', '( TAGS & :tag0 ) = :tag0', '( TAGS & :tag1 ) = :tag1', '( TAGS & :tag2 ) = :tag2', '( TAGS & :tag3 ) = :tag3', '( TAGS & :tag4 ) = :tag4', [':option', ':tag0', ':tag1', ':tag2', ':tag3', ':tag4']], 'NUM_NODES_INT' => ['NUM_NODES BETWEEN :min_nodes AND :max_nodes', 'NUM_NODES >=:min_nodes', 'NUM_NODES <=:max_nodes', [':min_nodes', ':max_nodes']], 'NUM_CORES_INT' => ['NUM_CORES BETWEEN :min_cores AND :max_cores', 'NUM_CORES >=:min_cores', 'NUM_CORES <=:max_cores', [':min_cores', ':max_cores']], 'WALLTIME_INT' => ['WALLTIME BETWEEN :min_walltime AND :max_walltime', 'WALLTIME >=:min_walltime', 'WALLTIME <=:max_walltime', [':min_walltime', ':max_walltime']], @@ -72,14 +72,14 @@ } else if ( $key == "TAGS" ) { $items = explode(" ", $value); $n = sizeof($items); - if ( $n > 1 ) { - for ( $i=0; $i<$n; $i++ ){ - $sql .= "AND ".$filterArray[$key][$i+1]." "; + if ( $items[0] == "and" ) { + $sql .= "AND ".$filterArray[$key][0]." "; + $attributes[$filterArray[$key][6][1]] = $items[1]; + } elseif ( $items[0] == "or" ) { + for ( $i=1; $i<$n; $i++ ){ + $sql .= "AND ".$filterArray[$key][$i]." "; $attributes[$filterArray[$key][6][$i]] = $items[$i]; } - } else { - $sql .= "AND ".$filterArray[$key][0]." "; - $attributes[$filterArray[$key][6][0]] = $items[0]; } } elseif ( strpos($key, '_INT') !== false ) { $items = explode(" ", $value); diff --git a/src/app/search/search.component.ts b/src/app/search/search.component.ts index c7c0188..2e94113 100644 --- a/src/app/search/search.component.ts +++ b/src/app/search/search.component.ts @@ -517,6 +517,7 @@ export class SearchComponent implements OnInit { else { this.jobtag_value= (Number(this.jobtag_bool[0]) + Number(this.jobtag_bool[1])*2 + Number(this.jobtag_bool[2])*4 + Number(this.jobtag_bool[3])*8 + Number(this.jobtag_bool[4])*16).toString(); } + this.jobtag_value = this.selected_jobtag_option + " " + this.jobtag_value; var jobtag_display; if ( this.jobtag_bool[0] ) { jobtag_display = "memory-bound"; -- GitLab