Skip to content

Commit 2482de7

Browse files
authored
Merge pull request #394 from icefoganalytics/test
More updates in WUP
2 parents 4c28ac8 + f674223 commit 2482de7

File tree

10 files changed

+132
-162
lines changed

10 files changed

+132
-162
lines changed

db/2025_updates.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ ALTER TABLE sfa.status_reason ADD funding_application_type_id INT NULL REFERENCE
8181

8282

8383
CREATE OR ALTER FUNCTION [sfa].[fn_financial_coding](@disbursement_id INT)
84-
RETURNS NVARCHAR
84+
RETURNS NVARCHAR(50)
8585
AS
8686
BEGIN
87-
DECLARE @coding NVARCHAR = '';
88-
87+
DECLARE @coding NVARCHAR(50) = '';
8988

9089
SELECT @coding = CASE
9190
WHEN app.funding_application_type_id = 2 AND d.disbursement_type_id = 11 THEN '031-500707-0301-8888'
@@ -226,4 +225,5 @@ WHERE NOT s.vendor_id IS NULL
226225
-- ORDER BY d.financial_batch_id_year, d.financial_batch_id, s.vendor_id;
227226

228227

229-
INSERT INTO sfa.disbursement_type (description, is_active) VALUES ('Cheque - LMDA', 1), ('Cheque - WDA', 1)
228+
INSERT INTO sfa.disbursement_type (description, is_active) VALUES ('Cheque - LMDA', 1), ('Cheque - WDA', 1)
229+

src/api/routes/admin/funding-application/funding-application-router.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fundingApplicationRouter.post(
6666
],
6767
});
6868
}
69-
}
69+
},
7070
);
7171

7272
// GET /:id - Get funding application by ID
@@ -85,26 +85,26 @@ fundingApplicationRouter.get(
8585
.leftJoin(
8686
"sfa.academic_year",
8787
"funding_application.academic_year_id",
88-
"academic_year.id"
88+
"academic_year.id",
8989
)
9090
.leftJoin(
9191
"sfa.funding_application_type",
9292
"funding_application.funding_application_type_id",
93-
"funding_application_type.id"
93+
"funding_application_type.id",
9494
)
9595
.select(
9696
"funding_application.*",
9797
"person.first_name",
9898
"person.last_name",
9999
"academic_year.year as academic_year",
100-
"funding_application_type.code AS type_code"
100+
"funding_application_type.code AS type_code",
101101
)
102102
.where("funding_application.id", parseInt(id))
103103
.first();
104104

105105
if (fundingApp) {
106106
fundingApp.application_data = JSON.parse(
107-
fundingApp.application_data || "{}"
107+
fundingApp.application_data || "{}",
108108
);
109109

110110
fundingApp.institution = await db("sfa.institution_campus")
@@ -140,7 +140,7 @@ fundingApplicationRouter.get(
140140
],
141141
});
142142
}
143-
}
143+
},
144144
);
145145

146146
// GET /:id - Get funding application by ID
@@ -205,7 +205,7 @@ fundingApplicationRouter.put(
205205
],
206206
});
207207
}
208-
}
208+
},
209209
);
210210

211211
fundingApplicationRouter.post(
@@ -269,7 +269,7 @@ fundingApplicationRouter.post(
269269
.innerJoin(
270270
"sfa.institution",
271271
"institution.id",
272-
"institution_campus.institution_id"
272+
"institution_campus.institution_id",
273273
)
274274
.where({
275275
"institution_campus.id": application.institution_campus_id,
@@ -327,7 +327,7 @@ fundingApplicationRouter.post(
327327
],
328328
});
329329
}
330-
}
330+
},
331331
);
332332

333333
// updates the status of a funding request
@@ -372,7 +372,7 @@ fundingApplicationRouter.put(
372372
],
373373
});
374374
}
375-
}
375+
},
376376
);
377377

378378
// deletes a funding request along with the disbursements and assessments
@@ -434,5 +434,5 @@ fundingApplicationRouter.delete(
434434
.status(409)
435435
.send({ messages: [{ variant: "error", text: "Error To Delete" }] });
436436
}
437-
}
437+
},
438438
);

src/api/routes/admin/funding-application/funding-request-router.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fundingRequestRouter.get(
4949
try {
5050
const builder = new AssessmentService(
5151
fundingRequest.application_id,
52-
fundingRequest.id
52+
fundingRequest.id,
5353
);
5454
await builder.load(true);
5555

@@ -73,7 +73,7 @@ fundingRequestRouter.get(
7373
}
7474

7575
res.json({ data: fundingRequest });
76-
}
76+
},
7777
);
7878

7979
fundingRequestRouter.post("/", async (req: Request, res: Response) => {
@@ -133,7 +133,7 @@ fundingRequestRouter.post("/", async (req: Request, res: Response) => {
133133
.innerJoin(
134134
"sfa.institution",
135135
"institution.id",
136-
"institution_campus.institution_id"
136+
"institution_campus.institution_id",
137137
)
138138
.where({
139139
"institution_campus.id": application.institution_campus_id,
@@ -236,24 +236,27 @@ fundingRequestRouter.patch(
236236
],
237237
});
238238
}
239-
}
239+
},
240240
);
241241

242242
// deletes a funding request along with the disbursements and assessments
243243
fundingRequestRouter.delete(
244-
"/:id/status",
244+
"/:id",
245245
[param("id").isInt().notEmpty()],
246246
ReturnValidationErrors,
247247
async (req: Request, res: Response) => {
248248
const { id } = req.params;
249+
250+
console.log("DELETE FUNDING REQUEST:", id);
251+
249252
try {
250253
const verifyRecord: any = await db("sfa.funding_request")
251-
.where({ funding_application_id: id })
254+
.where({ id })
252255
.first();
253256

254257
if (!verifyRecord) {
255258
return res.status(404).send({
256-
messages: [{ variant: "error", text: "The record does not exits" }],
259+
messages: [{ variant: "error", text: "Teh record does not exits" }],
257260
});
258261
}
259262

@@ -298,5 +301,5 @@ fundingRequestRouter.delete(
298301
.status(409)
299302
.send({ messages: [{ variant: "error", text: "Error To Delete" }] });
300303
}
301-
}
304+
},
302305
);

src/api/services/admin/assessments/wup-apprenticeship-service.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,26 @@ export class WUPApprenticeshipService {
3232
this.parent.assessment.parent_contribution_review = "NO";
3333

3434
if (reload) {
35-
const json_data = JSON.parse(
36-
this.parent.application.application_data || "{}"
37-
);
35+
const json_data = this.parent.fundingRequest.json_data;
3836

3937
this.parent.assessment.assessment_type_id =
4038
this.parent.assessment.assessment_type_id ?? 1;
41-
this.parent.assessment.classes_start_date = json_data.classesStartDate;
42-
this.parent.assessment.classes_end_date = json_data.classesEndDate;
39+
this.parent.assessment.classes_start_date = json_data.classes_start_date;
40+
this.parent.assessment.classes_end_date = json_data.classes_end_date;
4341
this.parent.assessment.weeks_allowed = weeksBetween(
44-
json_data.classesStartDate,
45-
json_data.classesEndDate
42+
json_data.classes_start_date,
43+
json_data.classes_end_date,
4644
);
4745

48-
this.parent.assessment.effective_rate_date = json_data.classesStartDate;
46+
this.parent.assessment.effective_rate_date = json_data.classes_start_date;
4947
const data = (this.parent.assessment.json_data =
5048
this.parent.fundingRequest.json_data);
5149

5250
const textbook = (data.textbook =
5351
cleanNumber(this.parent.fundingRequest.json_data.textbook) ?? 0);
5452
const transportation = (data.total_transportation =
5553
cleanNumber(
56-
this.parent.fundingRequest.json_data.weekly_transportation
54+
this.parent.fundingRequest.json_data.weekly_transportation,
5755
) ?? 0);
5856

5957
data.total_transportation =
@@ -157,7 +155,7 @@ export class WUPApprenticeshipService {
157155
for (const item of otherItems) {
158156
const hasItem =
159157
data.requested_supports.filter(
160-
(d: any) => d.type === item.expense_type
158+
(d: any) => d.type === item.expense_type,
161159
).length > 0;
162160

163161
if (!hasItem) {

src/web/src/components/application/wup-funding-requests/apprenticeship-training-support/ApprenticeshipTrainingForm.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,8 @@ export default {
439439
"Are you sure?",
440440
"Click 'Confirm' below to permanently remove this funding request.",
441441
async () => {
442-
console.log("DOING DELETE", this.fundingRequest.id);
443442
try {
444-
const resDelete = await axios.delete(FUNDING_APPLICATION_URL + `/${this.fundingRequest.id}/status`);
443+
const resDelete = await axios.delete(FUNDING_APPLICATION_URL + `/requests/${this.fundingRequest.id}`);
445444
446445
const message = resDelete.data.messages[0];
447446

0 commit comments

Comments
 (0)