Commit 92d97870391c807b3c90ac5babf4d1e480b93dd0
1 parent
fac4ffc1
Exists in
colab
and in
4 other branches
Dealing with ranges with beginning -INF and/or end +INF
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
app/helpers/processings_helper.rb
... | ... | @@ -11,8 +11,10 @@ module ProcessingsHelper |
11 | 11 | range_snapshots = metric_result.metric_configuration_snapshot.range_snapshot |
12 | 12 | |
13 | 13 | range_snapshots.each do |range_snapshot| |
14 | - return range_snapshot if (range_snapshot.beginning <= metric_result.value && range_snapshot.end >= metric_result.value) | |
14 | + return range_snapshot if ((range_snapshot.beginning <= metric_result.value || range_snapshot.beginning = '-INF') && (range_snapshot.end >= metric_result.value || range_snapshot.beginning = '+INF')) | |
15 | 15 | end |
16 | + | |
17 | + return nil | |
16 | 18 | end |
17 | 19 | |
18 | 20 | def format_module_name(module_name) | ... | ... |
app/views/modules/_metric_result.html.erb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | </td> |
12 | 12 | <td><%= format_grade(metric_result.value) %></td> |
13 | 13 | <td><%= metric_configuration_snapshot.weight %></td> |
14 | - <td><span style="color: #<%= range_snapshot.color %>"><%= range_snapshot.label %></span></td> | |
14 | + <td><% if range_snapshot.nil? %>Missing range<% else %><span style="color: #<%= range_snapshot.color %>"><%= range_snapshot.label %></span><% end %></td> | |
15 | 15 | </tr> |
16 | 16 | <tr id="container<%= metric_result.id %>" style="display: none"> |
17 | 17 | <td colspan="4"> | ... | ... |