From f326b8ec0382efb87c6394ba0a5e91a147935f3d Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 16 Dec 2020 20:16:45 -0800 Subject: [PATCH] Resolved attempted duplicate vehicle creation on import IO-471 --- .expo/README.md | 17 --------------- .expo/settings.json | 9 -------- .../jobs-available-new.container.jsx | 21 ++++++++++--------- 3 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 .expo/README.md delete mode 100644 .expo/settings.json diff --git a/.expo/README.md b/.expo/README.md deleted file mode 100644 index d8971e420..000000000 --- a/.expo/README.md +++ /dev/null @@ -1,17 +0,0 @@ -> Why do I have a folder named ".expo" in my project? - -The ".expo" folder is created when an Expo project is started using "expo start" command. - -> What does the "packager-info.json" file contain? - -The "packager-info.json" file contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator. - -> What does the "settings.json" file contain? - -The "settings.json" file contains the server configuration that is used to serve the application manifest. - -> Should I commit the ".expo" folder? - -No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine. - -Upon project creation, the ".expo" folder is already added to your ".gitignore" file. diff --git a/.expo/settings.json b/.expo/settings.json deleted file mode 100644 index c5ac37523..000000000 --- a/.expo/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "scheme": null, - "hostType": "lan", - "lanType": "ip", - "dev": true, - "minify": false, - "urlRandomness": null, - "https": false -} diff --git a/client/src/components/jobs-available-new/jobs-available-new.container.jsx b/client/src/components/jobs-available-new/jobs-available-new.container.jsx index 2f4f7b630..1806c5c39 100644 --- a/client/src/components/jobs-available-new/jobs-available-new.container.jsx +++ b/client/src/components/jobs-available-new/jobs-available-new.container.jsx @@ -1,4 +1,4 @@ -import { useApolloClient, useMutation, useQuery } from "@apollo/react-hooks"; +import { useMutation, useQuery, useApolloClient } from "@apollo/react-hooks"; import { notification } from "antd"; import Axios from "axios"; import Dinero from "dinero.js"; @@ -17,6 +17,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import AlertComponent from "../alert/alert.component"; import LoadingSpinner from "../loading-spinner/loading-spinner.component"; import JobsAvailableComponent from "./jobs-available-new.component"; +import { SEARCH_VEHICLE_BY_VIN } from "../../graphql/vehicles.queries"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -72,12 +73,12 @@ export function JobsAvailableContainer({ }) ).data; - // const existingVehicles = await client.query({ - // query: SEARCH_VEHICLE_BY_VIN, - // variables: { - // vin: estData.data.available_jobs_by_pk.est_data.vehicle.data.v_vin, - // }, - // }); + const existingVehicles = await client.query({ + query: SEARCH_VEHICLE_BY_VIN, + variables: { + vin: estData.data.available_jobs_by_pk.est_data.vehicle.data.v_vin, + }, + }); const newJob = { ...estData.data.available_jobs_by_pk.est_data, @@ -85,9 +86,9 @@ export function JobsAvailableContainer({ owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"), job_totals: newTotals, queued_for_parts: true, - // ...(existingVehicles.data.vehicles.length > 0 - // ? { vehicleid: existingVehicles.data.vehicles[0].id, vehicle: null } - // : {}), + ...(existingVehicles.data.vehicles.length > 0 + ? { vehicleid: existingVehicles.data.vehicles[0].id, vehicle: null } + : {}), }; insertNewJob({