Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
8319516d
Unverified
Commit
8319516d
authored
Aug 06, 2025
by
Colin Holzman
Committed by
GitHub
Aug 06, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: boolean filters (#4966)
parent
66b4f583
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
39 deletions
+7
-39
common_converter.go
plugin/filter/common_converter.go
+1
-17
dialect.go
plugin/filter/dialect.go
+0
-15
memo_filter_test.go
store/db/postgres/memo_filter_test.go
+6
-6
Home.tsx
web/src/pages/Home.tsx
+0
-1
No files found.
plugin/filter/common_converter.go
View file @
8319516d
...
@@ -550,23 +550,7 @@ func (c *CommonSQLConverter) handleBooleanComparison(ctx *ConvertContext, field,
...
@@ -550,23 +550,7 @@ func (c *CommonSQLConverter) handleBooleanComparison(ctx *ConvertContext, field,
// Handle PostgreSQL differently - it uses the raw operator
// Handle PostgreSQL differently - it uses the raw operator
if
_
,
ok
:=
c
.
dialect
.
(
*
PostgreSQLDialect
);
ok
{
if
_
,
ok
:=
c
.
dialect
.
(
*
PostgreSQLDialect
);
ok
{
var
jsonExtract
string
var
jsonExtract
=
c
.
dialect
.
GetJSONExtract
(
jsonPath
)
// Special handling for has_link, has_code, has_incomplete_tasks
if
field
==
"has_link"
||
field
==
"has_code"
||
field
==
"has_incomplete_tasks"
{
// Use memo-> format for these fields
parts
:=
strings
.
Split
(
strings
.
TrimPrefix
(
jsonPath
,
"$."
),
"."
)
jsonExtract
=
"memo->'payload'"
for
i
,
part
:=
range
parts
{
if
i
==
len
(
parts
)
-
1
{
jsonExtract
+=
fmt
.
Sprintf
(
"->>'%s'"
,
part
)
}
else
{
jsonExtract
+=
fmt
.
Sprintf
(
"->'%s'"
,
part
)
}
}
}
else
{
// Use standard format for has_task_list
jsonExtract
=
c
.
dialect
.
GetJSONExtract
(
jsonPath
)
}
sqlExpr
:=
fmt
.
Sprintf
(
"(%s)::boolean %s %s"
,
sqlExpr
:=
fmt
.
Sprintf
(
"(%s)::boolean %s %s"
,
jsonExtract
,
jsonExtract
,
...
...
plugin/filter/dialect.go
View file @
8319516d
...
@@ -203,21 +203,6 @@ func (d *PostgreSQLDialect) GetBooleanComparison(path string, _ bool) string {
...
@@ -203,21 +203,6 @@ func (d *PostgreSQLDialect) GetBooleanComparison(path string, _ bool) string {
}
}
func
(
d
*
PostgreSQLDialect
)
GetBooleanCheck
(
path
string
)
string
{
func
(
d
*
PostgreSQLDialect
)
GetBooleanCheck
(
path
string
)
string
{
// Special handling for standalone boolean identifiers
if
strings
.
Contains
(
path
,
"hasLink"
)
||
strings
.
Contains
(
path
,
"hasCode"
)
||
strings
.
Contains
(
path
,
"hasIncompleteTasks"
)
{
// Use memo-> instead of memo.payload-> for these fields
parts
:=
strings
.
Split
(
strings
.
TrimPrefix
(
path
,
"$."
),
"."
)
result
:=
fmt
.
Sprintf
(
"%s->'payload'"
,
d
.
GetTablePrefix
())
for
i
,
part
:=
range
parts
{
if
i
==
len
(
parts
)
-
1
{
result
+=
fmt
.
Sprintf
(
"->>'%s'"
,
part
)
}
else
{
result
+=
fmt
.
Sprintf
(
"->'%s'"
,
part
)
}
}
return
fmt
.
Sprintf
(
"(%s)::boolean = true"
,
result
)
}
// Use default format for other fields
return
fmt
.
Sprintf
(
"(%s)::boolean IS TRUE"
,
d
.
GetJSONExtract
(
path
))
return
fmt
.
Sprintf
(
"(%s)::boolean IS TRUE"
,
d
.
GetJSONExtract
(
path
))
}
}
...
...
store/db/postgres/memo_filter_test.go
View file @
8319516d
...
@@ -117,32 +117,32 @@ func TestConvertExprToSQL(t *testing.T) {
...
@@ -117,32 +117,32 @@ func TestConvertExprToSQL(t *testing.T) {
},
},
{
{
filter
:
`has_link == true`
,
filter
:
`has_link == true`
,
want
:
"(memo
->'payload'
->'property'->>'hasLink')::boolean = $1"
,
want
:
"(memo
.payload
->'property'->>'hasLink')::boolean = $1"
,
args
:
[]
any
{
true
},
args
:
[]
any
{
true
},
},
},
{
{
filter
:
`has_code == false`
,
filter
:
`has_code == false`
,
want
:
"(memo
->'payload'
->'property'->>'hasCode')::boolean = $1"
,
want
:
"(memo
.payload
->'property'->>'hasCode')::boolean = $1"
,
args
:
[]
any
{
false
},
args
:
[]
any
{
false
},
},
},
{
{
filter
:
`has_incomplete_tasks != false`
,
filter
:
`has_incomplete_tasks != false`
,
want
:
"(memo
->'payload'
->'property'->>'hasIncompleteTasks')::boolean != $1"
,
want
:
"(memo
.payload
->'property'->>'hasIncompleteTasks')::boolean != $1"
,
args
:
[]
any
{
false
},
args
:
[]
any
{
false
},
},
},
{
{
filter
:
`has_link`
,
filter
:
`has_link`
,
want
:
"(memo
->'payload'->'property'->>'hasLink')::boolean = true
"
,
want
:
"(memo
.payload->'property'->>'hasLink')::boolean IS TRUE
"
,
args
:
[]
any
{},
args
:
[]
any
{},
},
},
{
{
filter
:
`has_code`
,
filter
:
`has_code`
,
want
:
"(memo
->'payload'->'property'->>'hasCode')::boolean = true
"
,
want
:
"(memo
.payload->'property'->>'hasCode')::boolean IS TRUE
"
,
args
:
[]
any
{},
args
:
[]
any
{},
},
},
{
{
filter
:
`has_incomplete_tasks`
,
filter
:
`has_incomplete_tasks`
,
want
:
"(memo
->'payload'->'property'->>'hasIncompleteTasks')::boolean = true
"
,
want
:
"(memo
.payload->'property'->>'hasIncompleteTasks')::boolean IS TRUE
"
,
args
:
[]
any
{},
args
:
[]
any
{},
},
},
}
}
...
...
web/src/pages/Home.tsx
View file @
8319516d
...
@@ -50,7 +50,6 @@ const Home = observer(() => {
...
@@ -50,7 +50,6 @@ const Home = observer(() => {
conditions
.
push
(
`
${
factor
}
>=
${
timestampAfter
}
&&
${
factor
}
<
${
timestampAfter
+
60
*
60
*
24
}
`
);
conditions
.
push
(
`
${
factor
}
>=
${
timestampAfter
}
&&
${
factor
}
<
${
timestampAfter
+
60
*
60
*
24
}
`
);
}
}
}
}
console
.
log
(
"conditions"
,
conditions
);
return
conditions
.
length
>
0
?
conditions
.
join
(
" && "
)
:
undefined
;
return
conditions
.
length
>
0
?
conditions
.
join
(
" && "
)
:
undefined
;
},
[
memoFilterStore
.
filters
,
selectedShortcut
?.
filter
]);
},
[
memoFilterStore
.
filters
,
selectedShortcut
?.
filter
]);
...
...
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