Skip to content

Commit

Permalink
Merge pull request #471 from bcgov/mals2-26-fixes
Browse files Browse the repository at this point in the history
Mals2 26 fixes (part 1)
  • Loading branch information
mgtennant authored Oct 10, 2024
2 parents ab747ff + 80ad055 commit 939f4cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/client/src/features/lookups/licenceTypesSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ export const fetchLicenceTypes = createAsyncThunk(
async (_, thunkApi) => {
try {
const response = await Api.get("licence-types");
// The Licence Types have no particular order but Dairy Tank Truck must appear after Dairy Farm
// This code finds the indexes of each and places the Dairy Tank Truck licence just after Dairy Farm
if (response.data.length > 0) {
const dairyTankTruckIndex = response.data.findIndex(
(item) => item.licenceType === "DAIRY TANK TRUCK"
);
const dairyFarmIndex = response.data.findIndex(
(item) => item.licenceType === "DAIRY FARM"
);
if (dairyTankTruckIndex !== -1 && dairyFarmIndex !== -1) {
const [dairyTankTruck] = response.data.splice(dairyTankTruckIndex, 1);
response.data.splice(dairyFarmIndex + 1, 0, dairyTankTruck);
}
}
return response.data;
} catch (error) {
if (error instanceof ApiError) {
Expand Down
Binary file modified app/server/static/templates/certificates/Dairy-Tank-Truck.docx
Binary file not shown.

0 comments on commit 939f4cf

Please sign in to comment.