WIP Transfer.

This commit is contained in:
Patrick Fic
2020-09-21 14:40:16 -07:00
parent cb337b557c
commit 35650cec24
3 changed files with 44 additions and 27 deletions

View File

@@ -15,7 +15,7 @@ exports.job = async (req, res) => {
try {
const BearerToken = req.headers.authorization;
const { jobId } = req.body;
console.log("exports.job -> jobId", jobId)
console.log("exports.job -> jobId", jobId);
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
headers: {
@@ -30,7 +30,7 @@ exports.job = async (req, res) => {
jobId: jobId,
});
const { appointments, productionview } = result;
const { appointments, jobs } = result;
const { ssbuckets } = result.jobs_by_pk.bodyshop;
const jobHrs = result.jobs_by_pk.jobhrs.aggregate.sum.mod_lb_hrs;
@@ -45,7 +45,7 @@ exports.job = async (req, res) => {
const totalMatrixDays = moment
.max([
...appointments.map((a) => moment(a.start)),
...productionview
...jobs
.map((p) => moment(p.scheduled_completion))
.filter((p) => p.isValid()),
])
@@ -87,8 +87,10 @@ exports.job = async (req, res) => {
//Populate the jobs that are leaving today.
const todayIsoString = moment().format("yyyy-MM-DD");
productionview.forEach((pjob) => {
const jobHrs = pjob.larhrs + pjob.labhrs;
jobs.forEach((pjob) => {
const jobHrs =
pjob.larhrs.aggregate.sum.mod_lb_hrs +
pjob.labhrs.aggregate.sum.mod_lb_hrs;
//Is the job in the same bucket?
const pjobBucket = ssbuckets.filter(
(bucket) =>