Resolved attempted duplicate vehicle creation on import IO-471

This commit is contained in:
Patrick Fic
2020-12-16 20:16:45 -08:00
parent 0a1a9c199d
commit f326b8ec03
3 changed files with 11 additions and 36 deletions

View File

@@ -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.

View File

@@ -1,9 +0,0 @@
{
"scheme": null,
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": null,
"https": false
}

View File

@@ -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({