Skip to content

Commit

Permalink
fix(cvsb-19222): fix typo in column names
Browse files Browse the repository at this point in the history
  • Loading branch information
waringr committed Apr 20, 2021
1 parent 5d71275 commit af95ba9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 33 deletions.
12 changes: 6 additions & 6 deletions src/app/databaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ async function getVehicleDetails(
const vehicleDetailsResult = vehicleDetailsQueryResult[0][0] as VehicleQueryResult;

if (
vehicleDetailsResult === undefined ||
vehicleDetailsResult.id === undefined ||
vehicleDetailsResult.result === undefined
vehicleDetailsResult === undefined
|| vehicleDetailsResult.id === undefined
|| vehicleDetailsResult.result === undefined
) {
throw new NotFoundError('Vehicle was not found');
}
Expand Down Expand Up @@ -132,9 +132,9 @@ async function getTestResultDetails(
const testResultQueryResult = queryResult[0][0] as TestResultQueryResult;

if (
testResultQueryResult === undefined ||
testResultQueryResult.id === undefined ||
testResultQueryResult.result === undefined
testResultQueryResult === undefined
|| testResultQueryResult.id === undefined
|| testResultQueryResult.result === undefined
) {
throw new NotFoundError('Test not found');
}
Expand Down
47 changes: 24 additions & 23 deletions src/app/queries/technicalRecord/axleQuery.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
const AXLE_QUERY = 'SELECT `a`.`id`, JSON_OBJECT('
+ "'tyre', JSON_OBJECT("
+ "'tyreSize', `t`.`tyreSize`,"
+ "'plyRating', `t`.`plyRating`,"
+ "'fitmentCode', `t`.`fitmentCode`,"
+ "'dataTrAxles', `t`.`dataTrAxles`, "
+ "'speedCategorySymbol', `t`.`speedCategorySymbol`, "
+ "'tyreCode', `t`.`tyreCode`"
+ '), '
+ "'axleNumber', `a`.`axleNumber`, "
+ "'parkingBrakeMrk', IF(`a`.`parkingBrakeMrk` = 1, cast(TRUE AS json), cast(FALSE AS json)), "
+ "'kerbWeight', `a`.`kerbWeight`,"
+ "'ladenWeight', `a`.`ladenWeight`,"
+ "'gbWeight', `a`.`gbWeight`, "
+ "'eecWeight', `a`.`eecWeight`,"
+ "'designWeight', `a`.`designWeight`, "
+ "'brakeActuator', `a`.`brakeActuator`, "
+ "'leverLength', `a`.`leverLength`, "
+ "'springBrakeParking', IF(`a`.`springBrakeParking` = 1, cast(TRUE AS json), cast(FALSE AS json))"
+ ') result'
+ ' FROM `axles` `a`'
+ ' JOIN `tyre` t on `a`.`tyre_id` = `t`.`id`'
+ ' WHERE technical_record_id = ?;';
const AXLE_QUERY =
'SELECT `a`.`id`, JSON_OBJECT(' +
"'tyre', JSON_OBJECT(" +
"'tyreSize', `t`.`tyreSize`," +
"'plyRating', `t`.`plyRating`," +
"'fitmentCode', `t`.`fitmentCode`," +
"'dataTrAxles', `t`.`dataTrAxles`, " +
"'speedCategorySymbol', `t`.`speedCategorySymbol`, " +
"'tyreCode', `t`.`tyreCode`" +
'), ' +
"'axleNumber', `a`.`axleNumber`, " +
"'parkingBrakeMrk', IF(`a`.`parkingBrakeMrk` = 1, cast(TRUE AS json), cast(FALSE AS json)), " +
"'kerbWeight', `a`.`kerbWeight`," +
"'ladenWeight', `a`.`ladenWeight`," +
"'gbWeight', `a`.`gbWeight`, " +
"'eecWeight', `a`.`eecWeight`," +
"'designWeight', `a`.`designWeight`, " +
"'brakeActuator', `a`.`brakeActuator`, " +
"'leverLength', `a`.`leverLength`, " +
"'springBrakeParking', IF(`a`.`springBrakeParking` = 1, cast(TRUE AS json), cast(FALSE AS json))" +
') result' +
' FROM `axles` `a`' +
' JOIN `tyre` t on `a`.`tyre_id` = `t`.`id`' +
' WHERE technical_record_id = ?;';

export default AXLE_QUERY;
8 changes: 4 additions & 4 deletions src/app/queries/technicalRecord/technicalRecordQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ const TECHNICAL_RECORD_QUERY = 'SELECT `t`.`id`, JSON_OBJECT('
+ "'frontAxleTo5thWheelCouplingMax', `t`.`frontAxleTo5thWheelCouplingMax`, "
+ "'frontAxleToRearAxle', `t`.`frontAxleToRearAxle`,"
+ "'rearAxleToRearTrl', `t`.`rearAxleToRearTrl`, "
+ "'couplingCenterToRearAxleMin', `t`.`couplingCenterToRearAxleMin`, "
+ "'couplingCenterToRearAxleMax', `t`.`couplingCenterToRearAxleMax`,"
+ "'couplingCenterToRearTrlMin', `t`.`couplingCenterToRearTrlMin`, "
+ "'couplingCenterToRearTrlMax', `t`.`couplingCenterToRearTrlMax`, "
+ "'couplingCentreToRearAxleMin', `t`.`couplingCentreToRearAxleMin`, "
+ "'couplingCentreToRearAxleMax', `t`.`couplingCentreToRearAxleMax`,"
+ "'couplingCentreToRearTrlMin', `t`.`couplingCentreToRearTrlMin`, "
+ "'couplingCentreToRearTrlMax', `t`.`couplingCentreToRearTrlMax`, "
+ "'centreOfRearmostAxleToRearOfTrl', `t`.`centreOfRearmostAxleToRearOfTrl`, "
+ "'notes', `t`.`notes`, "
+ "'purchaserNotes', `t`.`purchaserNotes`,"
Expand Down

0 comments on commit af95ba9

Please sign in to comment.