Skip to content

Commit

Permalink
fix: cover person type time entries that do not have projectId
Browse files Browse the repository at this point in the history
  • Loading branch information
wang9hu committed Jun 14, 2024
1 parent 3e1ddd3 commit d2e4c65
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/controllers/timeEntryController.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,9 @@ const timeEntrycontroller = function (TimeEntry) {
record.userProfile = element.personId;
record.dateOfWork = element.dateOfWork;
[record.hours, record.minutes] = formatSeconds(element.totalSeconds);
record.projectId = element.projectId._id;
record.projectName = element.projectId.projectName;
record.projectCategory = element.projectId.category.toLowerCase();
record.projectId = element.projectId?._id || null;
record.projectName = element.projectId?.projectName || null;
record.projectCategory = element.projectId?.category.toLowerCase() || null;
record.taskId = element.taskId?._id || null;
record.taskName = element.taskId?.taskName || null;
record.taskClassification = element.taskId?.classification?.toLowerCase() || null;
Expand All @@ -934,6 +934,7 @@ const timeEntrycontroller = function (TimeEntry) {
res.status(200).send(data);
})
.catch((error) => {
logger.logException(error);
res.status(400).send(error);
});
};
Expand Down

0 comments on commit d2e4c65

Please sign in to comment.