summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-10 08:00:25 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-10 08:00:25 +0000
commit932d4cdfead379e24934df6530f4d98abcfab18e (patch)
tree05e4cdb1ff572d8c35df61260f2892d0b40c94ed
parent4a4a71349a45bdc8a55071e535bc0a8b9c02a5ee (diff)
downloadredmine-932d4cdfead379e24934df6530f4d98abcfab18e.tar.gz
redmine-932d4cdfead379e24934df6530f4d98abcfab18e.zip
Adds "between" operator for numeric filters (#6180).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6217 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/query.rb15
-rw-r--r--app/views/queries/_filters.rhtml25
-rw-r--r--config/locales/bg.yml1
-rw-r--r--config/locales/bs.yml1
-rw-r--r--config/locales/ca.yml1
-rw-r--r--config/locales/cs.yml1
-rw-r--r--config/locales/da.yml1
-rw-r--r--config/locales/de.yml1
-rw-r--r--config/locales/el.yml1
-rw-r--r--config/locales/en-GB.yml1
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/locales/es.yml1
-rw-r--r--config/locales/eu.yml1
-rw-r--r--config/locales/fa.yml1
-rw-r--r--config/locales/fi.yml1
-rw-r--r--config/locales/fr.yml1
-rw-r--r--config/locales/gl.yml1
-rw-r--r--config/locales/he.yml1
-rw-r--r--config/locales/hr.yml1
-rw-r--r--config/locales/hu.yml1
-rw-r--r--config/locales/id.yml1
-rw-r--r--config/locales/it.yml1
-rw-r--r--config/locales/ja.yml1
-rw-r--r--config/locales/ko.yml1
-rw-r--r--config/locales/lt.yml1
-rw-r--r--config/locales/lv.yml1
-rw-r--r--config/locales/mk.yml1
-rw-r--r--config/locales/mn.yml1
-rw-r--r--config/locales/nl.yml1
-rw-r--r--config/locales/no.yml1
-rw-r--r--config/locales/pl.yml1
-rw-r--r--config/locales/pt-BR.yml1
-rw-r--r--config/locales/pt.yml1
-rw-r--r--config/locales/ro.yml1
-rw-r--r--config/locales/ru.yml1
-rw-r--r--config/locales/sk.yml1
-rw-r--r--config/locales/sl.yml1
-rw-r--r--config/locales/sr-YU.yml1
-rw-r--r--config/locales/sr.yml1
-rw-r--r--config/locales/sv.yml1
-rw-r--r--config/locales/th.yml1
-rw-r--r--config/locales/tr.yml1
-rw-r--r--config/locales/uk.yml1
-rw-r--r--config/locales/vi.yml1
-rw-r--r--config/locales/zh-TW.yml1
-rw-r--r--config/locales/zh.yml1
-rw-r--r--test/test_helper.rb4
-rw-r--r--test/unit/query_test.rb15
48 files changed, 94 insertions, 9 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 165bbac84..fa8a449c5 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -101,6 +101,7 @@ class Query < ActiveRecord::Base
"*" => :label_all,
">=" => :label_greater_or_equal,
"<=" => :label_less_or_equal,
+ "><" => :label_between,
"<t+" => :label_in_less_than,
">t+" => :label_in_more_than,
"t+" => :label_in,
@@ -122,7 +123,7 @@ class Query < ActiveRecord::Base
:date_past => [ ">t-", "<t-", "t-", "t", "w" ],
:string => [ "=", "~", "!", "!~" ],
:text => [ "~", "!~" ],
- :integer => [ "=", ">=", "<=", "!*", "*" ] }
+ :integer => [ "=", ">=", "<=", "><", "!*", "*" ] }
cattr_reader :operators_by_filter_type
@@ -306,6 +307,10 @@ class Query < ActiveRecord::Base
def values_for(field)
has_filter?(field) ? filters[field][:values] : nil
end
+
+ def value_for(field, index=0)
+ (values_for(field) || [])[index]
+ end
def label_for(field)
label = available_filters[field][:name] if available_filters.has_key?(field)
@@ -627,6 +632,12 @@ class Query < ActiveRecord::Base
else
sql = "#{db_table}.#{db_field} <= #{value.first.to_i}"
end
+ when "><"
+ if is_custom_filter
+ sql = "CAST(#{db_table}.#{db_field} AS decimal(60,3)) BETWEEN #{value[0].to_i} AND #{value[1].to_i}"
+ else
+ sql = "#{db_table}.#{db_field} BETWEEN #{value[0].to_i} AND #{value[1].to_i}"
+ end
when "o"
sql = "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
when "c"
@@ -654,6 +665,8 @@ class Query < ActiveRecord::Base
sql = "LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'"
when "!~"
sql = "LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'"
+ else
+ raise "Unknown query operator #{operator}"
end
return sql
diff --git a/app/views/queries/_filters.rhtml b/app/views/queries/_filters.rhtml
index 1b564c172..e9c7502e1 100644
--- a/app/views/queries/_filters.rhtml
+++ b/app/views/queries/_filters.rhtml
@@ -22,13 +22,13 @@ function toggle_filter(field) {
if (check_box.checked) {
Element.show("operators_" + field);
Form.Element.enable("operators_" + field);
- Form.Element.enable("values_" + field);
+ $$(".values_" + field).each(function(el){ Form.Element.enable(el)});
toggle_operator(field);
} else {
Element.hide("operators_" + field);
Element.hide("div_values_" + field);
Form.Element.disable("operators_" + field);
- Form.Element.disable("values_" + field);
+ $$(".values_" + field).each(function(el){ Form.Element.disable(el)});
}
}
@@ -42,9 +42,18 @@ function toggle_operator(field) {
case "o":
case "c":
Element.hide("div_values_" + field);
+ var v = $$(".values_" + field);
+ if (v.length > 1) {v[1].hide(); Form.Element.disable(v[1])}
+ break;
+ case "><":
+ Element.show("div_values_" + field);
+ var v = $$(".values_" + field);
+ if (v.length > 1) {v[1].show(); Form.Element.enable(v[1])}
break;
default:
Element.show("div_values_" + field);
+ var v = $$(".values_" + field);
+ if (v.length > 1) {v[1].hide(); Form.Element.disable(v[1])}
break;
}
}
@@ -86,22 +95,22 @@ Event.observe(document,"dom:loaded", apply_filters_observer);
<%= check_box_tag 'f[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %>
<label for="cb_<%= field %>"><%= filter[1][:name] || l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label>
</td>
- <td style="width:150px;">
+ <td style="width:170px;">
<%= select_tag "op[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :id => "operators_#{field}", :onchange => "toggle_operator('#{field}');", :style => "vertical-align: top;" %>
</td>
<td>
<div id="div_values_<%= field %>" style="display:none;">
<% case options[:type]
when :list, :list_optional, :list_status, :list_subprojects %>
- <%= select_tag "v[#{field}][]", options_for_select(options[:values], query.values_for(field)), :id => "values_#{field}", :multiple => (query.values_for(field) && query.values_for(field).length > 1) %>
+ <%= select_tag "v[#{field}][]", options_for_select(options[:values], query.values_for(field)), :class => "values_#{field}", :multiple => (query.values_for(field) && query.values_for(field).length > 1) %>
<%= link_to_function image_tag('bullet_toggle_plus.png'), "toggle_multi_select('#{field}');", :style => "vertical-align: bottom;" %>
<% when :date, :date_past %>
- <%= text_field_tag "v[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3 %> <%= l(:label_day_plural) %>
+ <%= text_field_tag "v[#{field}][]", query.value_for(field), :class => "values_#{field}", :size => 3 %> <%= l(:label_day_plural) %>
<% when :string, :text %>
- <%= text_field_tag "v[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 30 %>
+ <%= text_field_tag "v[#{field}][]", query.value_for(field), :class => "values_#{field}", :size => 30 %>
<% when :integer %>
- <%= text_field_tag "v[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3 %>
- <%= text_field_tag "v[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3 %>
+ <%= text_field_tag "v[#{field}][]", query.value_for(field), :class => "values_#{field}", :size => 3 %>
+ <%= text_field_tag "v[#{field}][]", query.value_for(field, 1), :class => "values_#{field}", :size => 3 %>
<% end %>
</div>
<script type="text/javascript">toggle_filter('<%= field %>');</script>
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index 63fe0d49f..e4afd04ad 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -976,3 +976,4 @@ bg:
enumeration_activities: Дейности (time tracking)
enumeration_system_activity: Системна активност
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index c1f839ada..962e08d58 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -991,3 +991,4 @@ bs:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index c31236ea4..41ea899ee 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -980,3 +980,4 @@ ca:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index f59fe781f..3dfc14964 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -981,3 +981,4 @@ cs:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/da.yml b/config/locales/da.yml
index 9d81173ce..88849ed66 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -994,3 +994,4 @@ da:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 1ebd3eddb..535e3aec1 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -996,3 +996,4 @@ de:
text_scm_command_not_available: Scm Kommando ist nicht verfügbar. Bitte prüfen Sie die Einstellungen im Administrationspanel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/el.yml b/config/locales/el.yml
index c6bfba97f..c5566fadd 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -977,3 +977,4 @@ el:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml
index 9a7561dcb..0a3d793f8 100644
--- a/config/locales/en-GB.yml
+++ b/config/locales/en-GB.yml
@@ -980,3 +980,4 @@ en-GB:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/en.yml b/config/locales/en.yml
index fa47d0f4d..66792632b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -623,6 +623,7 @@ en:
label_in_more_than: in more than
label_greater_or_equal: '>='
label_less_or_equal: '<='
+ label_between: between
label_in: in
label_today: today
label_all_time: all time
diff --git a/config/locales/es.yml b/config/locales/es.yml
index b09abb88f..b2f4a5bd9 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -1014,3 +1014,4 @@ es:
text_scm_config: Puede configurar las órdenes de cada scm en configuration/configuration.yml. Por favor, reinicie la aplicación después de editarlo
text_scm_command_not_available: La orden para el Scm no está disponible. Por favor, compruebe la configuración en el panel de administración.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/eu.yml b/config/locales/eu.yml
index a84ed5415..fb0269332 100644
--- a/config/locales/eu.yml
+++ b/config/locales/eu.yml
@@ -981,3 +981,4 @@ eu:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/fa.yml b/config/locales/fa.yml
index b0947e20c..81fef9187 100644
--- a/config/locales/fa.yml
+++ b/config/locales/fa.yml
@@ -980,3 +980,4 @@ fa:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index 42ed57356..134823e59 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -998,3 +998,4 @@ fi:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index cb1d93b36..cf23259bd 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -939,6 +939,7 @@ fr:
enumeration_activities: Activités (suivi du temps)
label_greater_or_equal: ">="
label_less_or_equal: "<="
+ label_between: entre
label_view_all_revisions: Voir toutes les révisions
label_tag: Tag
label_branch: Branche
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index d3c0afd6f..7f40a42da 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -989,3 +989,4 @@ gl:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/he.yml b/config/locales/he.yml
index 64d59a761..ee37dba39 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -982,3 +982,4 @@ he:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index 7d53c3afb..9d0215d32 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -984,3 +984,4 @@ hr:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index e2878d36f..1262ebab0 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -996,3 +996,4 @@
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/id.yml b/config/locales/id.yml
index acec304bd..95b48db66 100644
--- a/config/locales/id.yml
+++ b/config/locales/id.yml
@@ -985,3 +985,4 @@ id:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/it.yml b/config/locales/it.yml
index 187a58700..da1f00d48 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -978,3 +978,4 @@ it:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index c90b83620..d026a7505 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -1007,3 +1007,4 @@ ja:
label_issues_visibility_public: プライベートチケット以外
text_issues_destroy_descendants_confirmation: %{count}個の子チケットも削除されます。
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 8c5f74eca..9cc8bade3 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -1029,3 +1029,4 @@ ko:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index 955bfd7b8..7ee5dc017 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -1037,3 +1037,4 @@ lt:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/lv.yml b/config/locales/lv.yml
index 63803cb3c..d436788f1 100644
--- a/config/locales/lv.yml
+++ b/config/locales/lv.yml
@@ -972,3 +972,4 @@ lv:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/mk.yml b/config/locales/mk.yml
index feec5780e..4832d6ac4 100644
--- a/config/locales/mk.yml
+++ b/config/locales/mk.yml
@@ -977,3 +977,4 @@ mk:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/mn.yml b/config/locales/mn.yml
index 4365425c2..b14a2a296 100644
--- a/config/locales/mn.yml
+++ b/config/locales/mn.yml
@@ -978,3 +978,4 @@ mn:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index d2551d7bd..9e20dd2f2 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -959,3 +959,4 @@ nl:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/no.yml b/config/locales/no.yml
index d0e62f98f..2e560cb65 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -964,3 +964,4 @@
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 1e1f02ed2..1af6d26ff 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -994,3 +994,4 @@ pl:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 34be79ab8..edf33a751 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -998,3 +998,4 @@ pt-BR:
text_scm_config: Você pode configurar seus comandos de versionamento em config/configurations.yml. Por favor reinicie a aplicação após alterá-lo.
text_scm_command_not_available: Comando de versionamento não disponível. Por favor verifique as configurações no painel de administração.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index 63faedb2e..36b36586b 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -982,3 +982,4 @@ pt:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index 44bb88841..c850c9008 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -970,3 +970,4 @@ ro:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 9cbbadd45..b67d0ad72 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -1090,3 +1090,4 @@ ru:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 53aad5427..3fbe62d45 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -972,3 +972,4 @@ sk:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 3bcce2f7d..afb023b1a 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -973,3 +973,4 @@ sl:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml
index 0f8338c01..a4c396bd2 100644
--- a/config/locales/sr-YU.yml
+++ b/config/locales/sr-YU.yml
@@ -977,3 +977,4 @@ sr-YU:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index 0b5539855..c908f944d 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -978,3 +978,4 @@ sr:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index ffe76456c..8bdf04cb2 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -1018,3 +1018,4 @@ sv:
enumeration_activities: Aktiviteter (tidsuppföljning)
enumeration_system_activity: Systemaktivitet
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/th.yml b/config/locales/th.yml
index ee8f1d2f3..bf701f2a5 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -974,3 +974,4 @@ th:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index cd599bc55..3b2f32927 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -996,3 +996,4 @@ tr:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index b31d33930..ad23b9ce3 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -973,3 +973,4 @@ uk:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index ded7f5e08..e4ffc6093 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -1028,3 +1028,4 @@ vi:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index d0f25ebb7..128278c52 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -1058,3 +1058,4 @@
enumeration_activities: 活動 (時間追蹤)
enumeration_system_activity: 系統活動
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 066f5e410..a9dbf29ca 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -980,3 +980,4 @@ zh:
text_scm_config: You can configure your scm commands in config/configuration.yml. Please restart the application after editing it.
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 0c082034b..3603befe7 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -127,6 +127,10 @@ class ActiveSupport::TestCase
def assert_error_tag(options={})
assert_tag({:attributes => { :id => 'errorExplanation' }}.merge(options))
end
+
+ def assert_include(expected, s)
+ assert s.include?(expected), "\"#{expected}\" not found in \"#{s}\""
+ end
# Shoulda macros
def self.should_render_404
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 55a67f26a..633edebb1 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -130,6 +130,21 @@ class QueryTest < ActiveSupport::TestCase
assert query.statement.include?("CAST(custom_values.value AS decimal(60,3)) <= 30")
find_issues_with_query(query)
end
+
+ def test_operator_between
+ query = Query.new(:project => Project.find(1), :name => '_')
+ query.add_filter('done_ratio', '><', ['30', '40'])
+ assert_include "#{Issue.table_name}.done_ratio BETWEEN 30 AND 40", query.statement
+ find_issues_with_query(query)
+ end
+
+ def test_operator_between_on_custom_field
+ f = IssueCustomField.create!(:name => 'filter', :field_format => 'int', :is_filter => true, :is_for_all => true)
+ query = Query.new(:project => Project.find(1), :name => '_')
+ query.add_filter("cf_#{f.id}", '><', ['30', '40'])
+ assert_include "CAST(custom_values.value AS decimal(60,3)) BETWEEN 30 AND 40", query.statement
+ find_issues_with_query(query)
+ end
def test_operator_in_more_than
Issue.find(7).update_attribute(:due_date, (Date.today + 15))