]> source.dussan.org Git - redmine.git/commitdiff
Adds "between" operator for numeric filters (#6180).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Jul 2011 08:00:25 +0000 (08:00 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Jul 2011 08:00:25 +0000 (08:00 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6217 e93f8b46-1217-0410-a6f0-8f06a7374b81

48 files changed:
app/models/query.rb
app/views/queries/_filters.rhtml
config/locales/bg.yml
config/locales/bs.yml
config/locales/ca.yml
config/locales/cs.yml
config/locales/da.yml
config/locales/de.yml
config/locales/el.yml
config/locales/en-GB.yml
config/locales/en.yml
config/locales/es.yml
config/locales/eu.yml
config/locales/fa.yml
config/locales/fi.yml
config/locales/fr.yml
config/locales/gl.yml
config/locales/he.yml
config/locales/hr.yml
config/locales/hu.yml
config/locales/id.yml
config/locales/it.yml
config/locales/ja.yml
config/locales/ko.yml
config/locales/lt.yml
config/locales/lv.yml
config/locales/mk.yml
config/locales/mn.yml
config/locales/nl.yml
config/locales/no.yml
config/locales/pl.yml
config/locales/pt-BR.yml
config/locales/pt.yml
config/locales/ro.yml
config/locales/ru.yml
config/locales/sk.yml
config/locales/sl.yml
config/locales/sr-YU.yml
config/locales/sr.yml
config/locales/sv.yml
config/locales/th.yml
config/locales/tr.yml
config/locales/uk.yml
config/locales/vi.yml
config/locales/zh-TW.yml
config/locales/zh.yml
test/test_helper.rb
test/unit/query_test.rb

index 165bbac849c48dcc2bcd1bc211f3e96d4d831841..fa8a449c5736b3b91b2556e6ce506c7e8b200516 100644 (file)
@@ -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
index 1b564c1725a3e66d25dbbb52c406479daf360f96..e9c7502e1e4fcc06eb452ef443c143d12a990088 100644 (file)
@@ -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>
index 63fe0d49f049223433ade319ae47d0970591f3b4..e4afd04adf182c95b113a43517534126ffd73858 100644 (file)
@@ -976,3 +976,4 @@ bg:
   enumeration_activities: Дейности (time tracking)
   enumeration_system_activity: Системна активност
   notice_issue_successful_create: Issue %{id} created.
+  label_between: between
index c1f839ada74d79e42d8860cc82444347702f2028..962e08d586aad3ca42a4c5bfacdf2d580a65c346 100644 (file)
@@ -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
index c31236ea4eb8e94f1d1e3559b030298b9245f303..41ea899eeedacf79a5ac3f1c0c292f039dc0b65d 100644 (file)
@@ -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
index f59fe781fb9988e92b5702341936dc542de78041..3dfc149649d9882c83347961f8efc4a47a20a335 100644 (file)
@@ -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
index 9d81173ce6f45e0b65245f292d9f9fe5f84e67f3..88849ed663956ae2370fbe1693af61dd73bf5f64 100644 (file)
@@ -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
index 1ebd3eddb9ef75ab26ad06d3fc7342a018e1e90b..535e3aec104570547dede2703c39c69587f1052d 100644 (file)
@@ -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
index c6bfba97f146142a3ef736b75d089de446d89e42..c5566fadd61dbc0cb9f70ea4d23d35bec9fce142 100644 (file)
@@ -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
index 9a7561dcb0a915214dd94e7752d8c4aeef6821f3..0a3d793f889c8d3f3c88a460aaf46f00f67d348a 100644 (file)
@@ -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
index fa47d0f4dc659cc4c83c155a4df0ac3b73758219..66792632b5ada7e1243a050d197e388f047def4f 100644 (file)
@@ -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
index b09abb88fcef6aedbdf9f2985a82f6a1a910b4a3..b2f4a5bd9827e8cecc23510b0cc7fd437011fe91 100644 (file)
@@ -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
index a84ed5415747458c68a0b6e856bb60a33cf8357b..fb0269332a20d8a3893bd900ccc78d0cfb5faa90 100644 (file)
@@ -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
index b0947e20c181f80b66ac5d600c75dc7bba34e6d6..81fef9187a8ff525f60749dc278abc891f1b174d 100644 (file)
@@ -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
index 42ed57356935af272261539f24d29a1226101ef9..134823e59fe94279be8f305732b8f2be34a2bdd9 100644 (file)
@@ -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
index cb1d93b36221f2af55cd45d002827ee9f11b1b66..cf23259bdc5ecba26e292c7b0afaeba48b899006 100644 (file)
@@ -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
index d3c0afd6f42cd88a9f2fc8f186591acad02299e5..7f40a42da74bbe087499d483b97cb307210dc2f4 100644 (file)
@@ -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
index 64d59a761d4aa02fb5f4a7aee01640ef41a6470b..ee37dba3976cce375eb73c642ae604813f4d241c 100644 (file)
@@ -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
index 7d53c3afbd3f3506bf14c6504f95cd94a4470621..9d0215d32579fb0f9b7a08972df7e088a3b05cb8 100644 (file)
@@ -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
index e2878d36f0f3f3ca565a09118f65e4952b42cd54..1262ebab0376620b71f1492a2c3a668f50cb0ae9 100644 (file)
   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
index acec304bdbda361c19f775b18bf2c38ebdae7d88..95b48db6659526d606ba66782a9aa9cce928d636 100644 (file)
@@ -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
index 187a58700fec2405d2608a3dc257edbab376b5b1..da1f00d48524970698f975f323f7cf6255d76e57 100644 (file)
@@ -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
index c90b83620ef7dbf55cfaeec8fac8efdfb679359d..d026a75059b79da9980f9ddb1231f6a0f73ed533 100644 (file)
@@ -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
index 8c5f74eca842c01bdb42bbb91fbf5dbbc5e3e1a2..9cc8bade30f7d40b926f099974f8e82919d650ad 100644 (file)
@@ -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
index 955bfd7b87f30faa61cc02a48b8934b022ee1627..7ee5dc017b7a8846e1e0fe21b30a0fb0d0df20e6 100644 (file)
@@ -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
index 63803cb3cdb09e01340c4aba51926b0b460d642f..d436788f1ae31475ab1f7bbf80c39c3a31abed72 100644 (file)
@@ -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
index feec5780e929d7a0796294d86731c266a39f7dee..4832d6ac4e21289cb5f4b2887c8cb12c9384b1df 100644 (file)
@@ -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
index 4365425c243276030308dfa293c09d2b7cabf6fd..b14a2a296015a2d987eed411d9763f58b785e217 100644 (file)
@@ -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
index d2551d7bd8fe905aa71ead5b166b1b5b0fe92628..9e20dd2f2cbb929873b3480a76420477c48a30f2 100644 (file)
@@ -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
index d0e62f98f06bb6049269c481dd99102dae6d0243..2e560cb659603357bbb2eb4b5ff2e1fc18e5538c 100644 (file)
   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
index 1e1f02ed23473d70606860640c2394ed21d3d3b6..1af6d26ff9be5ec72df3e3564a7a8c0586db51d4 100644 (file)
@@ -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
index 34be79ab8a8aa985a698b763684f8e22a5f29160..edf33a75166a07c1d8953b584ab14bd1a22ead60 100644 (file)
@@ -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
index 63faedb2ee8fe062a8c5fd52a8ea80848f8b669f..36b36586bdb6d6d4e57713dc0a4e818a6b31b964 100644 (file)
@@ -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
index 44bb88841daf7c2da69fe2958f754947e36b4da3..c850c90081f24dbe7896c9a1061c8a07947fee36 100644 (file)
@@ -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
index 9cbbadd45c3fdff520180b1d1836e5788ee55c56..b67d0ad7260e866cbf2b29a6c613ee702aeb4b09 100644 (file)
@@ -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
index 53aad5427e833f15fced6409e0d0a1c8195a40d9..3fbe62d455d75f798121913191d23f0c3d010c99 100644 (file)
@@ -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
index 3bcce2f7db13ec0e515ca1c944625bdf6a53e819..afb023b1ae0550c174797f60f2ebf62626b17830 100644 (file)
@@ -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
index 0f8338c010bf6f479e1fc0e7f58966aa3673c9cb..a4c396bd2b26ee08ed4bab5149076eafe1f86a2f 100644 (file)
@@ -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
index 0b5539855e9ff9b15638909cdbd6bb786d3b25c2..c908f944d7dddd491fcc2c108d040c3d61018a73 100644 (file)
@@ -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
index ffe76456c74348ccc236dba5c74e7e38a658dc41..8bdf04cb205f02868ce856333b5dec0c402a9314 100644 (file)
@@ -1018,3 +1018,4 @@ sv:
   enumeration_activities: Aktiviteter (tidsuppföljning)
   enumeration_system_activity: Systemaktivitet
   notice_issue_successful_create: Issue %{id} created.
+  label_between: between
index ee8f1d2f3352bc28e38b0203d4a5f6fcca228a83..bf701f2a563ba5f488b66d87542e5fc22f9a06d6 100644 (file)
@@ -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
index cd599bc5538fafe5e233778d66b5d0ed18dd1b19..3b2f32927071af4742cc707044a3a4bb485ed7f6 100644 (file)
@@ -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
index b31d33930c2c704217897b00bdfeacdf79c4f9ee..ad23b9ce3dda830e0deb80dc4438ac60a5447576 100644 (file)
@@ -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
index ded7f5e086f39f0c36b7fab436648e1f08d27526..e4ffc60932800833887a16faeb41ed1b609c57df 100644 (file)
@@ -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
index d0f25ebb7174e41eedf275de917506bff342987b..128278c52789144d0ac9c5c6d8ddccc80f75b4a1 100644 (file)
   enumeration_activities: 活動 (時間追蹤)
   enumeration_system_activity: 系統活動
   notice_issue_successful_create: Issue %{id} created.
+  label_between: between
index 066f5e41014c3cb144016b247db2aed063feebc5..a9dbf29ca7f016856d2608f844780e15fbc0b99c 100644 (file)
@@ -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
index 0c082034b1bf5e034b4432a45e7544d38e18c1c6..3603befe77f84bca750024ed45d03af9f97c2846 100644 (file)
@@ -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
index 55a67f26a8d02792b3a064b5bb333ef6c00a1901..633edebb1b182905b665c2298ae55c012d377d30 100644 (file)
@@ -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))