"*" => :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,
:date_past => [ ">t-", "<t-", "t-", "t", "w" ],
:string => [ "=", "~", "!", "!~" ],
:text => [ "~", "!~" ],
- :integer => [ "=", ">=", "<=", "!*", "*" ] }
+ :integer => [ "=", ">=", "<=", "><", "!*", "*" ] }
cattr_reader :operators_by_filter_type
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)
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"
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
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)});
}
}
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;
}
}
<%= 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>
enumeration_activities: Дейности (time tracking)
enumeration_system_activity: Системна активност
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
label_issues_visibility_public: プライベートチケット以外
text_issues_destroy_descendants_confirmation: %{count}個の子チケットも削除されます。
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
enumeration_activities: Aktiviteter (tidsuppföljning)
enumeration_system_activity: Systemaktivitet
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
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
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
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
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
enumeration_activities: 活動 (時間追蹤)
enumeration_system_activity: 系統活動
notice_issue_successful_create: Issue %{id} created.
+ label_between: between
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
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
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))