compare_groups_matrices needs three args, but now only get two, lost suites_list.
divide method to pass rubocop limit
Signed-off-by: Li Yuanchao lyc163mail@163.com --- src/lib/web_backend.rb | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/lib/web_backend.rb b/src/lib/web_backend.rb index 1f7224e..b5b06b4 100644 --- a/src/lib/web_backend.rb +++ b/src/lib/web_backend.rb @@ -147,6 +147,20 @@ def get_es_must(params) must end
+def _get_group_matrices(query, dimension) + result = es_query(query) + matrices, suites_list = combine_group_query_data(result, dimension) + while matrices.empty? + from += size + break if from > total + + query[:from] = from + result = es_query(query) + matrices, suites_list = combine_group_query_data(result, dimension) + end + [matrices, suites_list] +end + def get_groups_matrices(conditions, dimension, must, size, from) must += build_mutli_field_subquery_body(conditions) count_query = { query: { bool: { must: must } } } @@ -166,27 +180,18 @@ def get_groups_matrices(conditions, dimension, must, size, from) }] }
- result = es_query(query) - matrices = combine_group_query_data(result, dimension) - while matrices.empty? - from += size - break if from > total - - query[:from] = from - result = es_query(query) - matrices = combine_group_query_data(result, dimension) - end - matrices + matrices, suites_list = _get_groups_matrices(query, dimension) + [matrices, suites_list] end
def get_compare_body(params) dimension, conditions = get_dimension_conditions(params) must = get_es_must(params) - groups_matrices = get_groups_matrices(conditions, dimension, must, COMPARE_RECORDS_NUMBER, 0) + groups_matrices, suites_list = get_groups_matrices(conditions, dimension, must, COMPARE_RECORDS_NUMBER, 0) if !groups_matrices || groups_matrices.empty? body = 'No Data.' else - body = compare_group_matrices(groups_matrices, { no_print: true }) + body = compare_group_matrices(groups_matrices, suites_list, { no_print: true }) body = 'No Difference.' if !body || body.empty? end return body
On Thu, Nov 26, 2020 at 11:19:09AM +0800, Li Yuanchao wrote:
compare_groups_matrices needs three args, but now only get two, lost suites_list.
divide method to pass rubocop limit
Signed-off-by: Li Yuanchao lyc163mail@163.com
src/lib/web_backend.rb | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/lib/web_backend.rb b/src/lib/web_backend.rb index 1f7224e..b5b06b4 100644 --- a/src/lib/web_backend.rb +++ b/src/lib/web_backend.rb @@ -147,6 +147,20 @@ def get_es_must(params) must end
+def _get_group_matrices(query, dimension)
^ In ruby use _xx as an argument name to indicate that it won't be used.
Is that what you mean?
Thanks, Chenglong
- result = es_query(query)
- matrices, suites_list = combine_group_query_data(result, dimension)
- while matrices.empty?
- from += size
- break if from > total
- query[:from] = from
- result = es_query(query)
- matrices, suites_list = combine_group_query_data(result, dimension)
- end
- [matrices, suites_list]
+end
def get_groups_matrices(conditions, dimension, must, size, from) must += build_mutli_field_subquery_body(conditions) count_query = { query: { bool: { must: must } } } @@ -166,27 +180,18 @@ def get_groups_matrices(conditions, dimension, must, size, from) }] }
- result = es_query(query)
- matrices = combine_group_query_data(result, dimension)
- while matrices.empty?
- from += size
- break if from > total
- query[:from] = from
- result = es_query(query)
- matrices = combine_group_query_data(result, dimension)
- end
- matrices
- matrices, suites_list = _get_groups_matrices(query, dimension)
- [matrices, suites_list]
end
def get_compare_body(params) dimension, conditions = get_dimension_conditions(params) must = get_es_must(params)
- groups_matrices = get_groups_matrices(conditions, dimension, must, COMPARE_RECORDS_NUMBER, 0)
- groups_matrices, suites_list = get_groups_matrices(conditions, dimension, must, COMPARE_RECORDS_NUMBER, 0) if !groups_matrices || groups_matrices.empty? body = 'No Data.' else
- body = compare_group_matrices(groups_matrices, { no_print: true })
- body = compare_group_matrices(groups_matrices, suites_list, { no_print: true }) body = 'No Difference.' if !body || body.empty? end return body
-- 2.23.0