Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
7c4abeb8
Commit
7c4abeb8
authored
Jul 08, 2011
by
Felix Schäfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct filters for int,float custom fields. #498
parent
63d82643
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
query.rb
app/models/query.rb
+12
-2
No files found.
app/models/query.rb
View file @
7c4abeb8
...
...
@@ -587,9 +587,17 @@ class Query < ActiveRecord::Base
sql
=
"
#{
db_table
}
.
#{
db_field
}
IS NOT NULL"
sql
<<
" AND
#{
db_table
}
.
#{
db_field
}
<> ''"
if
is_custom_filter
when
">="
sql
=
"
#{
db_table
}
.
#{
db_field
}
>=
#{
value
.
first
.
to_i
}
"
if
is_custom_filter
sql
=
"
#{
db_table
}
.
#{
db_field
}
!= '' AND CAST(
#{
db_table
}
.
#{
db_field
}
AS decimal(60,4)) >=
#{
value
.
first
.
to_f
}
"
else
sql
=
"
#{
db_table
}
.
#{
db_field
}
>=
#{
value
.
first
.
to_f
}
"
end
when
"<="
sql
=
"
#{
db_table
}
.
#{
db_field
}
<=
#{
value
.
first
.
to_i
}
"
if
is_custom_filter
sql
=
"
#{
db_table
}
.
#{
db_field
}
!= '' AND CAST(
#{
db_table
}
.
#{
db_field
}
AS decimal(60,4)) <=
#{
value
.
first
.
to_f
}
"
else
sql
=
"
#{
db_table
}
.
#{
db_field
}
<=
#{
value
.
first
.
to_f
}
"
end
when
"o"
sql
=
"
#{
IssueStatus
.
table_name
}
.is_closed=
#{
connection
.
quoted_false
}
"
if
field
==
"status_id"
when
"c"
...
...
@@ -629,6 +637,8 @@ class Query < ActiveRecord::Base
custom_fields
.
select
(
&
:is_filter?
).
each
do
|
field
|
case
field
.
field_format
when
"int"
,
"float"
options
=
{
:type
=>
:integer
,
:order
=>
20
}
when
"text"
options
=
{
:type
=>
:text
,
:order
=>
20
}
when
"list"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment