Skip to content

Commit

Permalink
Align values in Leave backup with Import leaves file on CLOUD vertion (
Browse files Browse the repository at this point in the history
…#521)

So it is possible to migrate the OS to Cloud.

Co-authored-by: Pavlo <pavlo@>
  • Loading branch information
vpp authored Jul 5, 2022
1 parent 7f13062 commit 10cc4c9
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions lib/model/company/exporter/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CompanySummary {

// Put headers
results.push([
'Ddepartment', 'Lastname', 'Name', 'Email address',
'Department', 'Last name', 'Name', 'Email address',
'Type of absence', 'Started at', 'Date type', 'Ended at', 'Date type'
]);

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

const
start_date = moment(l.date_start).format(date_format),
end_date = moment(l.date_end).format(date_format);
const start_date = moment(l.date_start).format(date_format);
const end_date = moment(l.date_end).format(date_format);

const startDatePart = l.does_start_half_morning() ? 'Morning'
: l.does_start_half_afternoon() ? 'Afternoon'
: 'All Day';

const endDatePart = start_date === end_date ? startDatePart
: l.does_end_half_morning() ? 'Morning'
: l.does_end_half_afternoon() ? 'Afternoon'
: 'All Day';

results.push([
departmentsMap[ u.DepartmentId ].name,
Expand All @@ -74,18 +82,9 @@ class CompanySummary {
u.email,
leaveTypesMap[ l.leaveTypeId ].name,
start_date,
(
l.does_start_half_morning() ? 'morning'
: l.does_start_half_afternoon() ? 'afternoon'
: 'whole day'
),
startDatePart,
end_date,
(
start_date === end_date ? 'N/A'
: l.does_end_half_morning() ? 'morning'
: l.does_end_half_afternoon() ? 'afternoon'
: 'whole day'
),
endDatePart,
])
}));

Expand Down

0 comments on commit 10cc4c9

Please sign in to comment.