Skip to content

Commit 10cc4c9

Browse files
authored
Align values in Leave backup with Import leaves file on CLOUD vertion (#521)
So it is possible to migrate the OS to Cloud. Co-authored-by: Pavlo <pavlo@>
1 parent 7f13062 commit 10cc4c9

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

lib/model/company/exporter/summary.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CompanySummary {
4646

4747
// Put headers
4848
results.push([
49-
'Ddepartment', 'Lastname', 'Name', 'Email address',
49+
'Department', 'Last name', 'Name', 'Email address',
5050
'Type of absence', 'Started at', 'Date type', 'Ended at', 'Date type'
5151
]);
5252

@@ -63,9 +63,17 @@ class CompanySummary {
6363
// Get a row per every leave
6464
.forEach(u => u.my_leaves.forEach(l => {
6565

66-
const
67-
start_date = moment(l.date_start).format(date_format),
68-
end_date = moment(l.date_end).format(date_format);
66+
const start_date = moment(l.date_start).format(date_format);
67+
const end_date = moment(l.date_end).format(date_format);
68+
69+
const startDatePart = l.does_start_half_morning() ? 'Morning'
70+
: l.does_start_half_afternoon() ? 'Afternoon'
71+
: 'All Day';
72+
73+
const endDatePart = start_date === end_date ? startDatePart
74+
: l.does_end_half_morning() ? 'Morning'
75+
: l.does_end_half_afternoon() ? 'Afternoon'
76+
: 'All Day';
6977

7078
results.push([
7179
departmentsMap[ u.DepartmentId ].name,
@@ -74,18 +82,9 @@ class CompanySummary {
7482
u.email,
7583
leaveTypesMap[ l.leaveTypeId ].name,
7684
start_date,
77-
(
78-
l.does_start_half_morning() ? 'morning'
79-
: l.does_start_half_afternoon() ? 'afternoon'
80-
: 'whole day'
81-
),
85+
startDatePart,
8286
end_date,
83-
(
84-
start_date === end_date ? 'N/A'
85-
: l.does_end_half_morning() ? 'morning'
86-
: l.does_end_half_afternoon() ? 'afternoon'
87-
: 'whole day'
88-
),
87+
endDatePart,
8988
])
9089
}));
9190

0 commit comments

Comments
 (0)