Add claimed task name to tickets.

This commit is contained in:
Patrick Fic
2023-07-28 08:22:38 -07:00
parent ab2cf8c8c7
commit fe16329443
10 changed files with 126 additions and 22 deletions

View File

@@ -31,6 +31,12 @@ exports.claimtask = async function (req, res) {
const theTaskPreset = job.bodyshop.md_tasks_presets.presets.find(
(tp) => tp.name === task
);
if (!theTaskPreset) {
res
.status(400)
.json({ success: false, error: "Provided task preset not found." });
return;
}
//Get all of the assignments that are filtered.
const { assignmentHash, employeeHash } = CalculateExpectedHoursForJob(
@@ -52,6 +58,7 @@ exports.claimtask = async function (req, res) {
(theTaskPreset.percent / 100);
ticketsToInsert.push({
task_name: task,
jobid: job.id,
bodyshopid: job.bodyshop.id,
employeeid: employeeIdKey,