Skip to content

Commit 1bb5c08

Browse files
author
Vikas Agarwal
committed
Github issue#376, Timeline is not updated in ES
— Updated the timeline object as well from the cascaded data — Removed unused code
1 parent 3253e74 commit 1bb5c08

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

src/events/milestones/index.js

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -82,35 +82,16 @@ const milestoneUpdatedHandler = Promise.coroutine(function* (logger, msg, channe
8282
});
8383
}
8484

85-
// if (data.original.order !== data.updated.order) {
86-
// const milestoneWithSameOrder =
87-
// _.find(milestones, milestone => milestone.id !== data.updated.id && milestone.order === data.updated.order);
88-
// if (milestoneWithSameOrder) {
89-
// // Increase the order from M to K: if there is an item with order K,
90-
// // orders from M+1 to K should be made M to K-1
91-
// if (data.original.order < data.updated.order) {
92-
// _.each(milestones, (single) => {
93-
// if (single.id !== data.updated.id
94-
// && (data.original.order + 1) <= single.order
95-
// && single.order <= data.updated.order) {
96-
// single.order -= 1; // eslint-disable-line no-param-reassign
97-
// }
98-
// });
99-
// } else {
100-
// // Decrease the order from M to K: if there is an item with order K,
101-
// // orders from K to M-1 should be made K+1 to M
102-
// _.each(milestones, (single) => {
103-
// if (single.id !== data.updated.id
104-
// && data.updated.order <= single.order
105-
// && single.order <= (data.original.order - 1)) {
106-
// single.order += 1; // eslint-disable-line no-param-reassign
107-
// }
108-
// });
109-
// }
110-
// }
111-
// }
85+
let cTimeline = null;
86+
// if timeline is modified
87+
if (data.cascadedUpdates && data.cascadedUpdates.timeline) {
88+
cTimeline = data.cascadedUpdates.timeline;
89+
// if endDate of the timeline is modified, update the end date in the index
90+
if (cTimeline.original.endDate !== cTimeline.updated.endDate) {
91+
}
92+
}
11293

113-
const merged = _.assign(doc._source, { milestones }); // eslint-disable-line no-underscore-dangle
94+
const merged = _.assign(doc._source, cTimeline, { milestones }); // eslint-disable-line no-underscore-dangle
11495
yield eClient.update({
11596
index: ES_TIMELINE_INDEX,
11697
type: ES_TIMELINE_TYPE,

0 commit comments

Comments
 (0)