Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simple_controller
Project
Overview
Details
Activity
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
open-source
simple_controller
Commits
4836cc26
Commit
4836cc26
authored
Aug 20, 2023
by
Ivan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: group_index 最后一级重复问题
parent
d4bf9714
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
group_index.rb
lib/simple_controller/group_index.rb
+6
-8
No files found.
lib/simple_controller/group_index.rb
View file @
4836cc26
...
@@ -50,20 +50,18 @@ module SimpleController::GroupIndex
...
@@ -50,20 +50,18 @@ module SimpleController::GroupIndex
def
tree_result_mount_data
(
tree_result
,
statistics
,
group_configs
,
depth
=
0
)
def
tree_result_mount_data
(
tree_result
,
statistics
,
group_configs
,
depth
=
0
)
(
tree_result
||
[]).
map
do
|
key
,
value
|
(
tree_result
||
[]).
map
do
|
key
,
value
|
children
=
children
=
if
value
.
is_a?
(
Hash
)
if
depth
>
group_configs
.
length
[]
elsif
value
.
is_a?
(
Hash
)
tree_result_mount_data
(
value
,
statistics
,
group_configs
,
depth
+
1
)
tree_result_mount_data
(
value
,
statistics
,
group_configs
,
depth
+
1
)
elsif
value
.
is_a?
(
Array
)
elsif
value
.
is_a?
(
Array
)
fake_tree_result
=
value
.
map
{
|
ary_key
|
[
ary_key
.
last
,
[
ary_key
]]
}.
to_h
fake_tree_result
=
value
.
map
{
|
ary_key
|
[
ary_key
.
last
,
[
ary_key
]]
}.
to_h
if
fake_tree_result
==
tree_result
[]
else
tree_result_mount_data
(
tree_result_mount_data
(
fake_tree_result
,
fake_tree_result
,
statistics
,
statistics
,
group_configs
,
group_configs
,
depth
+
1
depth
+
1
,
)
)
end
else
else
[]
[]
end
end
...
@@ -72,10 +70,10 @@ module SimpleController::GroupIndex
...
@@ -72,10 +70,10 @@ module SimpleController::GroupIndex
children:
children
,
children:
children
,
}.
merge
(
}.
merge
(
key
.
nil?
?
{
key
.
nil?
?
{
ransack_key:
(
group_configs
[
depth
]
||
group_configs
.
last
)
[:
ransack_key
].
gsub
(
/_eq$/
,
'_null'
),
ransack_key:
group_configs
[
depth
]
[:
ransack_key
].
gsub
(
/_eq$/
,
'_null'
),
ransack_value:
true
,
ransack_value:
true
,
}
:
{
}
:
{
ransack_key:
(
group_configs
[
depth
]
||
group_configs
.
last
)
[
:ransack_key
],
ransack_key:
group_configs
[
depth
]
[
:ransack_key
],
ransack_value:
key
,
ransack_value:
key
,
}
}
)
)
...
...
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