Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
00d0e57e
Commit
00d0e57e
authored
Feb 27, 2013
by
Sato Hiroyuki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commits are arranged below their first parent.
parent
14c2a37d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
app/models/graph/json_builder.rb
app/models/graph/json_builder.rb
+19
-2
No files found.
app/models/graph/json_builder.rb
View file @
00d0e57e
...
@@ -181,7 +181,8 @@ module Graph
...
@@ -181,7 +181,8 @@ module Graph
end
end
time_range
=
leaves
.
last
.
time
..
leaves
.
first
.
time
time_range
=
leaves
.
last
.
time
..
leaves
.
first
.
time
space
=
find_free_space
(
time_range
,
2
)
space_base
=
get_space_base
(
leaves
,
map
)
space
=
find_free_space
(
time_range
,
2
,
space_base
)
leaves
.
each
do
|
l
|
leaves
.
each
do
|
l
|
l
.
spaces
<<
space
l
.
spaces
<<
space
# Also add space to parent
# Also add space to parent
...
@@ -223,13 +224,29 @@ module Graph
...
@@ -223,13 +224,29 @@ module Graph
end
end
end
end
def
get_space_base
(
leaves
,
map
)
space_base
=
1
if
leaves
.
last
.
parents
.
size
>
0
first_parent
=
leaves
.
last
.
parents
.
first
if
map
.
include?
(
first_parent
.
id
)
first_p
=
map
[
first_parent
.
id
]
if
first_p
.
space
>
0
space_base
=
first_p
.
space
end
end
end
space_base
end
def
mark_reserved
(
time_range
,
space
)
def
mark_reserved
(
time_range
,
space
)
for
day
in
time_range
for
day
in
time_range
@_reserved
[
day
].
push
(
space
)
@_reserved
[
day
].
push
(
space
)
end
end
end
end
def
find_free_space
(
time_range
,
space_step
,
space_base
=
1
,
space_default
=
1
)
def
find_free_space
(
time_range
,
space_step
,
space_base
=
1
,
space_default
=
nil
)
space_default
||=
space_base
reserved
=
[]
reserved
=
[]
for
day
in
time_range
for
day
in
time_range
reserved
+=
@_reserved
[
day
]
reserved
+=
@_reserved
[
day
]
...
...
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