要把没有用的内容删掉:)
current patch do: compare_values by each metrics ---> format/show results
Signed-off-by: Lu Weitao luweitaobe@163.com
Signed-off-by: Lu Weitao luweitaobe@163.com
Duplicated "Signed-off-by".
ok, Thanks for ponit
+def assign_metric_change(metrics_values)
- metrics_values.each do |metric, values|
- metrics_values[metric]['change'] = {}
Whether this line is necessary?
这一行总是要写的, next if values['average'].size < 2 却别在于写在这一行前还是后?
当没有change(只有一个compare dimension), (写next前)输出结果中的change也会显示{}: metric = { 'average' => {...}, 'stddev' => {...}, 'change' =>{} }
(写next后)输出结果就没有‘change’ 这组key-value了 metric = { 'average' => {...}, 'stddev' => {...} } 看起来不显示 'change' =>{} 也可以
Why not use "values['change'] = {}"?
yes!
这里用values['change']比 metrics_value[metric]['change'] 好一些, 已经对metrics_values 做了遍历,不需要再用key查询
Thanks, Weitao
Thanks, Zhang Yuhang
- next if values['average'].size < 2
- dimension_list = values['average'].keys
- dimension_groups = get_dimensions_combination(dimension_list)
- dimension_groups.each do |base_dimension, challenge_dimension|
change = get_compare_value(values['average'][base_dimension], values['average'][challenge_dimension], true)
values['change'] = { "#{challenge_dimension} vs #{base_dimension}" => change }
- end
- end
+end