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
6b922831
Commit
6b922831
authored
Nov 15, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Map timePeriodConstraints to parsedTime.
parent
6b17dc25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
15 deletions
+10
-15
app/assets/javascripts/issuable_time_tracker.js.es6
app/assets/javascripts/issuable_time_tracker.js.es6
+10
-15
No files found.
app/assets/javascripts/issuable_time_tracker.js.es6
View file @
6b922831
...
...
@@ -124,31 +124,26 @@ function getRandomInt(min, max) {
},
parseSeconds (seconds) {
const DAYS_PER_WEEK = 5, HOURS_PER_DAY = 8, MINUTES_PER_HOUR = 60;
const MINUTES_PER_WEEK = DAYS_PER_WEEK * HOURS_PER_DAY * MINUTES_PER_HOUR;
const MINUTES_PER_DAY = HOURS_PER_DAY * MINUTES_PER_HOUR;
const timePeriodConstraints = [
[ 'weeks', MINUTES_PER_WEEK ],
[ 'days', MINUTES_PER_DAY ],
[ 'hours', MINUTES_PER_HOUR ],
[ 'minutes', 1 ]
];
// Seee if you can just MAP that ^^ to the result
const parsedTime = {};
const timePeriodConstraints = {
weeks: MINUTES_PER_WEEK,
days: MINUTES_PER_DAY,
hours: MINUTES_PER_HOUR,
minutes: 1
};
let unorderedMinutes = this.secondsToMinutes(seconds);
timePeriodConstraints.forEach((period, idx, collection) => {
const periodName = period[0];
const minutesPerPeriod = period[1];
return _.mapObject(timePeriodConstraints, (minutesPerPeriod, periodName ) => {
const periodCount = Math.floor(unorderedMinutes / minutesPerPeriod);
unorderedMinutes -= (periodCount * minutesPerPeriod);
parsedTime[periodName] = periodCount;
});
return parsedTime;
return periodCount;
});
},
abbreviateTime(value) {
return value.split(' ')[0];
...
...
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