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
e0e4058d
Commit
e0e4058d
authored
Dec 16, 2021
by
Andrew Smith
Committed by
Andrew Smith
Dec 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Align roadmap quarters to calendar quarters
Changelog: fixed EE: true
parent
335f5a54
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
8 deletions
+38
-8
ee/app/assets/javascripts/roadmap/utils/roadmap_utils.js
ee/app/assets/javascripts/roadmap/utils/roadmap_utils.js
+18
-1
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
+2
-2
ee/spec/frontend/roadmap/utils/roadmap_item_utils_spec.js
ee/spec/frontend/roadmap/utils/roadmap_item_utils_spec.js
+1
-1
ee/spec/frontend/roadmap/utils/roadmap_utils_spec.js
ee/spec/frontend/roadmap/utils/roadmap_utils_spec.js
+17
-4
No files found.
ee/app/assets/javascripts/roadmap/utils/roadmap_utils.js
View file @
e0e4058d
...
@@ -29,6 +29,19 @@ export const getWeeksForDates = (startDate, endDate) => {
...
@@ -29,6 +29,19 @@ export const getWeeksForDates = (startDate, endDate) => {
return
timeframe
;
return
timeframe
;
};
};
export
const
getMonthsForDates
=
(
startDate
,
endDate
)
=>
{
const
timeframe
=
[];
const
start
=
newDate
(
startDate
);
const
end
=
newDate
(
endDate
);
while
(
start
.
getTime
()
<
end
.
getTime
())
{
timeframe
.
push
(
newDate
(
start
));
start
.
setMonth
(
start
.
getMonth
()
+
1
);
}
return
timeframe
;
};
export
const
getTimeframeForRangeType
=
({
export
const
getTimeframeForRangeType
=
({
timeframeRangeType
=
DATE_RANGES
.
CURRENT_QUARTER
,
timeframeRangeType
=
DATE_RANGES
.
CURRENT_QUARTER
,
presetType
=
PRESET_TYPES
.
WEEKS
,
presetType
=
PRESET_TYPES
.
WEEKS
,
...
@@ -89,7 +102,11 @@ export const getTimeframeForRangeType = ({
...
@@ -89,7 +102,11 @@ export const getTimeframeForRangeType = ({
startDate
.
setDate
(
1
);
startDate
.
setDate
(
1
);
if
(
presetType
===
PRESET_TYPES
.
QUARTERS
)
{
if
(
presetType
===
PRESET_TYPES
.
QUARTERS
)
{
timeframe
=
getTimeframeWindowFrom
(
startDate
,
18
*
2
);
// Shift start and end dates to align with calender quarters
startDate
.
setMonth
(
startDate
.
getMonth
()
-
(
startDate
.
getMonth
()
%
3
));
endDate
.
setMonth
(
endDate
.
getMonth
()
+
(
2
-
(
endDate
.
getMonth
()
%
3
)));
timeframe
=
getMonthsForDates
(
startDate
,
endDate
);
const
quartersTimeframe
=
[];
const
quartersTimeframe
=
[];
// Iterate over the timeframe and break it down
// Iterate over the timeframe and break it down
...
...
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
View file @
e0e4058d
...
@@ -86,7 +86,7 @@ describe('ee/roadmap/components/epics_list_empty.vue', () => {
...
@@ -86,7 +86,7 @@ describe('ee/roadmap/components/epics_list_empty.vue', () => {
});
});
expect
(
findSubTitle
().
text
()).
toBe
(
expect
(
findSubTitle
().
text
()).
toBe
(
'
To view the roadmap, add a start or due date to one of your epics in this group or its subgroups; from Jul 1, 2016 to
Jun
30, 2019.
'
,
'
To view the roadmap, add a start or due date to one of your epics in this group or its subgroups; from Jul 1, 2016 to
Sep
30, 2019.
'
,
);
);
});
});
...
@@ -99,7 +99,7 @@ describe('ee/roadmap/components/epics_list_empty.vue', () => {
...
@@ -99,7 +99,7 @@ describe('ee/roadmap/components/epics_list_empty.vue', () => {
});
});
expect
(
findSubTitle
().
text
()).
toBe
(
expect
(
findSubTitle
().
text
()).
toBe
(
'
To widen your search, change or remove filters; from Jul 1, 2016 to
Jun
30, 2019.
'
,
'
To widen your search, change or remove filters; from Jul 1, 2016 to
Sep
30, 2019.
'
,
);
);
});
});
});
});
...
...
ee/spec/frontend/roadmap/utils/roadmap_item_utils_spec.js
View file @
e0e4058d
...
@@ -176,7 +176,7 @@ describe('timeframeEndDate', () => {
...
@@ -176,7 +176,7 @@ describe('timeframeEndDate', () => {
*/
*/
it
.
each
`
it
.
each
`
presetType | endDate | timeframe
presetType | endDate | timeframe
${
PRESET_TYPES
.
QUARTERS
}
|
${
dateFromString
(
'
May 31
2022
'
)}
|
${
mockQuarterly
.
timeframe
}
${
PRESET_TYPES
.
QUARTERS
}
|
${
dateFromString
(
'
Jun 30
2022
'
)}
|
${
mockQuarterly
.
timeframe
}
${
PRESET_TYPES
.
MONTHS
}
|
${
dateFromString
(
'
Dec 31 2020
'
)}
|
${
mockMonthly
.
timeframe
}
${
PRESET_TYPES
.
MONTHS
}
|
${
dateFromString
(
'
Dec 31 2020
'
)}
|
${
mockMonthly
.
timeframe
}
${
PRESET_TYPES
.
WEEKS
}
|
${
dateFromString
(
'
Jan 03 2021
'
)}
|
${
mockWeekly
.
timeframe
}
${
PRESET_TYPES
.
WEEKS
}
|
${
dateFromString
(
'
Jan 03 2021
'
)}
|
${
mockWeekly
.
timeframe
}
`
(
`
(
...
...
ee/spec/frontend/roadmap/utils/roadmap_utils_spec.js
View file @
e0e4058d
import
{
PRESET_TYPES
,
DATE_RANGES
}
from
'
ee/roadmap/constants
'
;
import
{
PRESET_TYPES
,
DATE_RANGES
}
from
'
ee/roadmap/constants
'
;
import
{
import
{
getEpicsTimeframeRange
,
getEpicsTimeframeRange
,
getWeeksForDates
,
getMonthsForDates
,
getPresetTypeForTimeframeRangeType
,
getTimeframeForRangeType
,
getTimeframeForRangeType
,
getWeeksForDates
,
sortEpics
,
sortEpics
,
getPresetTypeForTimeframeRangeType
,
}
from
'
ee/roadmap/utils/roadmap_utils
'
;
}
from
'
ee/roadmap/utils/roadmap_utils
'
;
import
{
mockTimeframeInitialDate
,
mockUnsortedEpics
}
from
'
../mock_data
'
;
import
{
mockTimeframeInitialDate
,
mockUnsortedEpics
}
from
'
../mock_data
'
;
...
@@ -27,6 +28,18 @@ describe('getWeeksForDates', () => {
...
@@ -27,6 +28,18 @@ describe('getWeeksForDates', () => {
});
});
});
});
describe
(
'
getMonthsForDates
'
,
()
=>
{
it
(
'
returns months for given start and due dates
'
,
()
=>
{
const
months
=
getMonthsForDates
(
mockTimeframeInitialDate
,
mockTimeframeMonths
[
4
]);
expect
(
months
).
toHaveLength
(
4
);
const
dates
=
[
'
2018-01-01
'
,
'
2018-02-01
'
,
'
2018-03-01
'
,
'
2018-04-01
'
];
dates
.
forEach
((
date
,
index
)
=>
{
expect
(
getDateString
(
months
[
index
])).
toBe
(
date
);
});
});
});
describe
(
'
getTimeframeForRangeType
'
,
()
=>
{
describe
(
'
getTimeframeForRangeType
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
jest
.
useFakeTimers
(
'
modern
'
);
jest
.
useFakeTimers
(
'
modern
'
);
...
@@ -77,7 +90,7 @@ describe('getTimeframeForRangeType', () => {
...
@@ -77,7 +90,7 @@ describe('getTimeframeForRangeType', () => {
presetType
:
PRESET_TYPES
.
QUARTERS
,
presetType
:
PRESET_TYPES
.
QUARTERS
,
});
});
expect
(
timeframe
).
toHaveLength
(
1
2
);
expect
(
timeframe
).
toHaveLength
(
1
3
);
expect
(
timeframe
[
0
]).
toMatchObject
({
expect
(
timeframe
[
0
]).
toMatchObject
({
quarterSequence
:
3
,
quarterSequence
:
3
,
...
@@ -139,7 +152,7 @@ describe('getEpicsTimeframeRange', () => {
...
@@ -139,7 +152,7 @@ describe('getEpicsTimeframeRange', () => {
expect
.
objectContaining
({
expect
.
objectContaining
({
timeframe
:
{
timeframe
:
{
start
:
'
2016-07-01
'
,
start
:
'
2016-07-01
'
,
end
:
'
2019-0
6
-30
'
,
end
:
'
2019-0
9
-30
'
,
},
},
}),
}),
);
);
...
...
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