Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
corteza
corteza-server
Commits
f69ffe01
Commit
f69ffe01
authored
4 years ago
by
Tomaž Jerman
Browse files
Options
Download
Email Patches
Plain Diff
Fix filter nesting for chart filters
parent
2b3b2f17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
compose/repository/record_report_builder.go
compose/repository/record_report_builder.go
+5
-1
compose/repository/record_report_builder_test.go
compose/repository/record_report_builder_test.go
+1
-1
No files found.
compose/repository/record_report_builder.go
View file @
f69ffe01
...
...
@@ -150,7 +150,11 @@ func (b *recordReportBuilder) Build(metrics, dimensions, filters string) (sql st
return
}
b
.
report
=
b
.
report
.
Where
(
filter
)
// We need to wrap this one level deeper, since additional filters should
// be evaluated as a whole.
// For example A AND B OR C =should be> (A AND B OR C)
// so the output becomes BASE AND (ADDITIONAL)
b
.
report
=
b
.
report
.
Where
(
ql
.
ASTNodes
{
filter
})
}
return
b
.
report
.
ToSql
()
...
...
This diff is collapsed.
Click to expand it.
compose/repository/record_report_builder_test.go
View file @
f69ffe01
...
...
@@ -24,7 +24,7 @@ func TestRecordReportBuilder2(t *testing.T) {
"FROM compose_record AS r "
+
"LEFT JOIN compose_record_value AS rv_single1 ON (rv_single1.record_id = r.id AND rv_single1.name = ? AND rv_single1.deleted_at IS NULL) "
+
"LEFT JOIN compose_record_value AS rv_ref1 ON (rv_ref1.record_id = r.id AND rv_ref1.name = ? AND rv_ref1.deleted_at IS NULL) "
+
"WHERE r.deleted_at IS NULL AND r.module_id = ? AND rv_ref1.value = 2 "
+
"WHERE r.deleted_at IS NULL AND r.module_id = ? AND
(
rv_ref1.value = 2
)
"
+
"GROUP BY dimension_0 "
+
"ORDER BY dimension_0"
...
...
This diff is collapsed.
Click to expand it.
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