if job has suite, but no $suite related stats metric, then discard this job when create matrix. --- lib/matrix2.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index 2507b77..f1b2c78 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -76,10 +76,15 @@ def create_matrix(job_list) matrix = {} suites = [] job_list.each do |job| - suites << job['suite'] if job['suite'] stats = job['stats'] next unless stats
+ if job['suite'] + next unless stats.keys.any? { |stat| stat.start_with?(job['suite']) } + + suites << job['suite'] + end + stats.each do |key, value| matrix[key] = [] unless matrix[key] matrix[key] << value
On Sat, Dec 19, 2020 at 03:16:21PM +0800, Lu Kaiyi wrote:
if job has suite, but no $suite related stats metric, then discard this job when create matrix.
why do this, we should give the reason in change log
lib/matrix2.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index 2507b77..f1b2c78 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -76,10 +76,15 @@ def create_matrix(job_list)
the function create_matrix(job_list) have too many lines, more then 15 lines we should fix the rubocop warning at first
Thanks, Weitao
matrix = {} suites = [] job_list.each do |job|
- suites << job['suite'] if job['suite'] stats = job['stats'] next unless stats
- if job['suite']
next unless stats.keys.any? { |stat| stat.start_with?(job['suite']) }
suites << job['suite']
- end
stats.each do |key, value| matrix[key] = [] unless matrix[key] matrix[key] << value
-- 2.23.0
On Sat, Dec 19, 2020 at 03:16:21PM +0800, Lu Kaiyi wrote:
if job has suite, but no $suite related stats metric, then discard this job when create matrix.
lib/matrix2.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index 2507b77..f1b2c78 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -76,10 +76,15 @@ def create_matrix(job_list) matrix = {} suites = [] job_list.each do |job|
- suites << job['suite'] if job['suite'] stats = job['stats'] next unless stats
- if job['suite']
next unless stats.keys.any? { |stat| stat.start_with?(job['suite']) }
suites << job['suite']
- end
it may not enough, we should handle the empty matrix matrix: {} matrix_list: [{}, {}, ...] group_matrix: { group1_key => { dimension_1 => {} dimension_2 => {} ... group2_key => {...}
Thanks, Weitao
stats.each do |key, value| matrix[key] = [] unless matrix[key] matrix[key] << value
-- 2.23.0