Commit 932883f3cabe5db60b133eb08140de3c820ce9e0
Committed by
Heitor
1 parent
1cf91eb7
Exists in
colab
and in
4 other branches
ModuleResult ordering done through Granularity built-in comparisons
kalibro_client updated: It enables Granularity ordering Signed off by: Rafael Reggiani Manzo
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
Gemfile.lock
app/helpers/kalibro_modules_helper.rb
1 | 1 | module KalibroModulesHelper |
2 | 2 | def sort_by_granularity_and_name(module_results) |
3 | - module_results.sort do |a,b| | |
4 | - (a.kalibro_module.granularity == b.kalibro_module.granularity) ? a.kalibro_module.name <=> b.kalibro_module.name : -a.kalibro_module.granularity.length <=> -b.kalibro_module.granularity.length | |
3 | + module_results.sort! do |a,b| | |
4 | + if (a.kalibro_module.granularity == b.kalibro_module.granularity) | |
5 | + a.kalibro_module.name <=> b.kalibro_module.name | |
6 | + else | |
7 | + (KalibroClient::Entities::Miscellaneous::Granularity.new(b.kalibro_module.granularity.to_sym) <=> KalibroClient::Entities::Miscellaneous::Granularity.new(a.kalibro_module.granularity.to_sym)) | |
8 | + end | |
5 | 9 | end |
6 | 10 | end |
7 | 11 | end |
8 | 12 | \ No newline at end of file | ... | ... |