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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f0831056
Commit
f0831056
authored
Nov 18, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alter ChronicDuration config only for Time Tracking stuff.
parent
77eea067
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
config/initializers/chronic_duration.rb
config/initializers/chronic_duration.rb
+0
-4
lib/gitlab/time_tracking_formatter.rb
lib/gitlab/time_tracking_formatter.rb
+19
-4
No files found.
config/initializers/chronic_duration.rb
View file @
f0831056
ChronicDuration
.
raise_exceptions
=
true
# We may want to configure it through project settings in a future version.
ChronicDuration
.
hours_per_day
=
8
ChronicDuration
.
days_per_week
=
5
lib/gitlab/time_tracking_formatter.rb
View file @
f0831056
...
...
@@ -3,13 +3,28 @@ module Gitlab
extend
self
def
parse
(
string
)
ChronicDuration
.
parse
(
string
,
default_unit:
'hours'
)
rescue
ChronicDuration
::
DurationParseError
nil
with_custom_config
do
ChronicDuration
.
parse
(
string
,
default_unit:
'hours'
)
rescue
nil
end
end
def
output
(
seconds
)
ChronicDuration
.
output
(
seconds
,
format: :short
,
limit_to_hours:
false
,
weeks:
true
)
with_custom_config
do
ChronicDuration
.
output
(
seconds
,
format: :short
,
limit_to_hours:
false
,
weeks:
true
)
rescue
nil
end
end
def
with_custom_config
# We may want to configure it through project settings in a future version.
ChronicDuration
.
hours_per_day
=
8
ChronicDuration
.
days_per_week
=
5
result
=
yield
ChronicDuration
.
hours_per_day
=
24
ChronicDuration
.
days_per_week
=
7
result
end
end
end
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