Adds "between" operator for numeric filters (#6180).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6217 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-07-10 08:00:25 +00:00
parent 4a4a71349a
commit 932d4cdfea
48 changed files with 94 additions and 9 deletions

View File

@ -101,6 +101,7 @@ class Query < ActiveRecord::Base
"*" => :label_all, "*" => :label_all,
">=" => :label_greater_or_equal, ">=" => :label_greater_or_equal,
"<=" => :label_less_or_equal, "<=" => :label_less_or_equal,
"><" => :label_between,
"<t+" => :label_in_less_than, "<t+" => :label_in_less_than,
">t+" => :label_in_more_than, ">t+" => :label_in_more_than,
"t+" => :label_in, "t+" => :label_in,
@ -122,7 +123,7 @@ class Query < ActiveRecord::Base
:date_past => [ ">t-", "<t-", "t-", "t", "w" ], :date_past => [ ">t-", "<t-", "t-", "t", "w" ],
:string => [ "=", "~", "!", "!~" ], :string => [ "=", "~", "!", "!~" ],
:text => [ "~", "!~" ], :text => [ "~", "!~" ],
:integer => [ "=", ">=", "<=", "!*", "*" ] } :integer => [ "=", ">=", "<=", "><", "!*", "*" ] }
cattr_reader :operators_by_filter_type cattr_reader :operators_by_filter_type
@ -307,6 +308,10 @@ class Query < ActiveRecord::Base
has_filter?(field) ? filters[field][:values] : nil has_filter?(field) ? filters[field][:values] : nil
end end
def value_for(field, index=0)
(values_for(field) || [])[index]
end
def label_for(field) def label_for(field)
label = available_filters[field][:name] if available_filters.has_key?(field) label = available_filters[field][:name] if available_filters.has_key?(field)
label ||= field.gsub(/\_id$/, "") label ||= field.gsub(/\_id$/, "")
@ -627,6 +632,12 @@ class Query < ActiveRecord::Base
else else
sql = "#{db_table}.#{db_field} <= #{value.first.to_i}" sql = "#{db_table}.#{db_field} <= #{value.first.to_i}"
end 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" when "o"
sql = "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id" sql = "#{IssueStatus.table_name}.is_closed=#{connection.quoted_false}" if field == "status_id"
when "c" 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)}%'" sql = "LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'"
when "!~" when "!~"
sql = "LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'" sql = "LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'"
else
raise "Unknown query operator #{operator}"
end end
return sql return sql

View File

@ -22,13 +22,13 @@ function toggle_filter(field) {
if (check_box.checked) { if (check_box.checked) {
Element.show("operators_" + field); Element.show("operators_" + field);
Form.Element.enable("operators_" + field); Form.Element.enable("operators_" + field);
Form.Element.enable("values_" + field); $$(".values_" + field).each(function(el){ Form.Element.enable(el)});
toggle_operator(field); toggle_operator(field);
} else { } else {
Element.hide("operators_" + field); Element.hide("operators_" + field);
Element.hide("div_values_" + field); Element.hide("div_values_" + field);
Form.Element.disable("operators_" + 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 "o":
case "c": case "c":
Element.hide("div_values_" + field); 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; break;
default: default:
Element.show("div_values_" + field); Element.show("div_values_" + field);
var v = $$(".values_" + field);
if (v.length > 1) {v[1].hide(); Form.Element.disable(v[1])}
break; 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}" %> <%= 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> <label for="cb_<%= field %>"><%= filter[1][:name] || l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label>
</td> </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;" %> <%= 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>
<td> <td>
<div id="div_values_<%= field %>" style="display:none;"> <div id="div_values_<%= field %>" style="display:none;">
<% case options[:type] <% case options[:type]
when :list, :list_optional, :list_status, :list_subprojects %> 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;" %> <%= link_to_function image_tag('bullet_toggle_plus.png'), "toggle_multi_select('#{field}');", :style => "vertical-align: bottom;" %>
<% when :date, :date_past %> <% 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 %> <% 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 %> <% when :integer %>
<%= 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.values_for(field), :id => "values_#{field}", :size => 3 %> <%= text_field_tag "v[#{field}][]", query.value_for(field, 1), :class => "values_#{field}", :size => 3 %>
<% end %> <% end %>
</div> </div>
<script type="text/javascript">toggle_filter('<%= field %>');</script> <script type="text/javascript">toggle_filter('<%= field %>');</script>

View File

@ -976,3 +976,4 @@ bg:
enumeration_activities: Дейности (time tracking) enumeration_activities: Дейности (time tracking)
enumeration_system_activity: Системна активност enumeration_system_activity: Системна активност
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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. 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. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View File

@ -623,6 +623,7 @@ en:
label_in_more_than: in more than label_in_more_than: in more than
label_greater_or_equal: '>=' label_greater_or_equal: '>='
label_less_or_equal: '<=' label_less_or_equal: '<='
label_between: between
label_in: in label_in: in
label_today: today label_today: today
label_all_time: all time label_all_time: all time

View 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_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. 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. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View File

@ -939,6 +939,7 @@ fr:
enumeration_activities: Activités (suivi du temps) enumeration_activities: Activités (suivi du temps)
label_greater_or_equal: ">=" label_greater_or_equal: ">="
label_less_or_equal: "<=" label_less_or_equal: "<="
label_between: entre
label_view_all_revisions: Voir toutes les révisions label_view_all_revisions: Voir toutes les révisions
label_tag: Tag label_tag: Tag
label_branch: Branche label_branch: Branche

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View File

@ -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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View File

@ -1007,3 +1007,4 @@ ja:
label_issues_visibility_public: プライベートチケット以外 label_issues_visibility_public: プライベートチケット以外
text_issues_destroy_descendants_confirmation: %{count}個の子チケットも削除されます。 text_issues_destroy_descendants_confirmation: %{count}個の子チケットも削除されます。
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View File

@ -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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. 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. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View File

@ -1018,3 +1018,4 @@ sv:
enumeration_activities: Aktiviteter (tidsuppföljning) enumeration_activities: Aktiviteter (tidsuppföljning)
enumeration_system_activity: Systemaktivitet enumeration_system_activity: Systemaktivitet
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View File

@ -1058,3 +1058,4 @@
enumeration_activities: 活動 (時間追蹤) enumeration_activities: 活動 (時間追蹤)
enumeration_system_activity: 系統活動 enumeration_system_activity: 系統活動
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View 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_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. text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created. notice_issue_successful_create: Issue %{id} created.
label_between: between

View File

@ -128,6 +128,10 @@ class ActiveSupport::TestCase
assert_tag({:attributes => { :id => 'errorExplanation' }}.merge(options)) assert_tag({:attributes => { :id => 'errorExplanation' }}.merge(options))
end end
def assert_include(expected, s)
assert s.include?(expected), "\"#{expected}\" not found in \"#{s}\""
end
# Shoulda macros # Shoulda macros
def self.should_render_404 def self.should_render_404
should_respond_with :not_found should_respond_with :not_found

View File

@ -131,6 +131,21 @@ class QueryTest < ActiveSupport::TestCase
find_issues_with_query(query) find_issues_with_query(query)
end 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 def test_operator_in_more_than
Issue.find(7).update_attribute(:due_date, (Date.today + 15)) Issue.find(7).update_attribute(:due_date, (Date.today + 15))
query = Query.new(:project => Project.find(1), :name => '_') query = Query.new(:project => Project.find(1), :name => '_')