Skip to content

Commit

Permalink
Merge pull request #161 from icefoganalytics/test
Browse files Browse the repository at this point in the history
Debugging and format improvements
  • Loading branch information
datajohnson authored Sep 29, 2023
2 parents c9a8866 + 0f8e888 commit bcde134
Show file tree
Hide file tree
Showing 31 changed files with 1,521 additions and 1,594 deletions.
29 changes: 29 additions & 0 deletions src/api/repositories/assessment/assessment-cslft-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,20 +505,34 @@ export class AssessmentCslftRepository extends AssessmentBaseRepository {

await this.getCalculatedAward();

// this is to debug a specific event
if (this.assessment.id == 36101) {
console.log("CHECKING 36101 ************");
console.log("*** calculated_award", this.assessment.calculated_award);
console.log("*** csl_full_amt_flag", this.assessment.csl_full_amt_flag);
console.log("*** csl_request_amount", this.assessment.csl_request_amount);
console.log("*** recovered_overaward", this.assessment.recovered_overaward);
}

// Calculate the totaln_disbursments_required
if (!this.assessment.csl_full_amt_flag) {
if (this.assessment.id == 36101) console.log("*** in if");

this.assessment.assessed_amount = Math.max(
Math.min(this.assessment.calculated_award ?? 0, this.assessment.csl_request_amount ?? 0) -
(this.assessment.recovered_overaward ?? 0),
0
);
} else {
if (this.assessment.id == 36101) console.log("*** in else");
this.assessment.assessed_amount = Math.max(
(this.assessment.calculated_award ?? 0) - (this.assessment.recovered_overaward ?? 0),
0
);
}

if (this.assessment.id == 36101) console.log("*** assessed_amount", this.assessment.assessed_amount);

this.assessment.net_amount = this.getNetAmount(
this.assessment.assessed_amount,
this.assessment.previous_disbursement,
Expand Down Expand Up @@ -1168,19 +1182,34 @@ export class AssessmentCslftRepository extends AssessmentBaseRepository {
await this.getCalculatedAward();
}


// this is to debug a specific event
if (this.assessment.id == 36101) {
console.log("CHECKING 36101 ###########");
console.log("### calculated_award", this.assessment.calculated_award);
console.log("### csl_full_amt_flag", this.assessment.csl_full_amt_flag);
console.log("### csl_request_amount", this.assessment.csl_request_amount);
console.log("### recovered_overaward", this.assessment.recovered_overaward);
}


// Calculate the totaln_disbursments_required
if (!this.assessment.csl_full_amt_flag) {
if (this.assessment.id == 36101) console.log("### in if");
this.assessment.assessed_amount = Math.max(
Math.min(this.assessment.calculated_award ?? 0, this.assessment.csl_request_amount ?? 0) -
(this.assessment.recovered_overaward ?? 0),
0
);
} else {
if (this.assessment.id == 36101) console.log("### in else");
this.assessment.assessed_amount = Math.max(
(this.assessment.calculated_award ?? 0) - (this.assessment.recovered_overaward ?? 0),
0
);
}

if (this.assessment.id == 36101) console.log("### assessed_amount", this.assessment.assessed_amount);

this.assessment.net_amount = this.getNetAmount(
this.assessment.assessed_amount,
Expand Down
8 changes: 6 additions & 2 deletions src/api/routes/admin/csg-threshold-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const csgThresholdRouter = express.Router();

csgThresholdRouter.get("/:academic_year_id", async (req: Request, res: Response) => {
const { academic_year_id } = req.params;
res.json({ data: await db("sfa.csg_threshold").where({ academic_year_id }) });
let data = await db("sfa.csg_threshold").where({ academic_year_id });
let rates = await db("sfa.csg_lookup").where({ academic_year_id }).first();
res.json({ data, rates });
});

csgThresholdRouter.get("/cslft/:application_id", async (req: Request, res: Response) => {
Expand Down Expand Up @@ -162,7 +164,9 @@ csgThresholdRouter.get("/csgft/:application_id", async (req: Request, res: Respo

csgThresholdRouter.post(
"/csgftdep/:application_id/funding-request/:funding_request_id/assessment",
param("application_id").isInt(), param("funding_request_id").isInt(), ReturnValidationErrors,
param("application_id").isInt(),
param("funding_request_id").isInt(),
ReturnValidationErrors,
async (req: Request, res: Response) => {
const { application_id, funding_request_id } = req.params;

Expand Down
9 changes: 2 additions & 7 deletions src/web/src/components/application/ApplicationDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<v-tab key="3">Statistical Info</v-tab>
</v-tabs>

<v-tabs-items v-model="tab" style="padding: 20px">
<v-tabs-items v-model="tab" style="padding: 20px 0">
<v-tab-item key="0">
<!-- TODO Review academic-year component -->
<!-- <academic-year></academic-year> -->
Expand Down Expand Up @@ -60,12 +60,10 @@ export default {
this.applicationId = this.$route.params.id;
if (this.$route.path.indexOf("/application/") >= 0) {
//console.log("LOADING STUDENT BASED ON URL");
await store.dispatch("loadApplication", this.applicationId);
store.dispatch("setAppSidebar", true);
} else {
if (this.applicationId != storeApp.HISTORY_DETAIL_ID) {
console.log("ENTRE APPLICTION BASED ON URL");
if (this.applicationId != storeApp.id) {
await store.dispatch("loadApplication", this.applicationId);
store.dispatch("setAppSidebar", true);
}
Expand All @@ -75,9 +73,6 @@ export default {
student: function(val) {
if (val) this.updateView(val);
},
selectedApplication: function(val) {
console.log("WATCH selectedApplication", val);
},
},
methods: {
showSuccess(mgs) {
Expand Down
4 changes: 2 additions & 2 deletions src/web/src/components/application/ProgramInformationForm.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<v-card class="default mb-5">
<v-card-title>Institution</v-card-title>
<v-card-title class="text-h6 font-weight-regular">Institution</v-card-title>
<v-card-text class="row">
<div class="col-md-3">
<div class="row">
Expand Down Expand Up @@ -179,7 +179,7 @@
</v-card>

<v-card class="default mb-5">
<v-card-title>Program</v-card-title>
<v-card-title class="text-h6 font-weight-regular">Program</v-card-title>
<v-card-text class="row">
<div class="col-md-4">
<div class="row">
Expand Down
4 changes: 2 additions & 2 deletions src/web/src/components/application/StatisticalForm.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<v-card class="default">
<v-card-title>Basic Demographics</v-card-title>
<v-card-title class="text-h6 font-weight-regular">Basic Demographics</v-card-title>
<v-card-text>
<div class="row">
<div class="col-md-3">
Expand Down Expand Up @@ -73,7 +73,7 @@
</v-card>

<v-card class="default mt-5">
<v-card-title>Statistical Demographics</v-card-title>
<v-card-title class="text-h6 font-weight-regular">Statistical Demographics</v-card-title>
<v-card-text>
<div class="row">
<div class="col-md-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const state = {
disbursements: [],
parentAssessment: {},
parentDisbursements: [],
baseRate: 280,
baseRate: 0.00,
};
const getters = {
familyIncome(state) {
Expand Down Expand Up @@ -116,6 +116,9 @@ const mutations = {
SET_THRESHOLDS(state, value) {
state.csgThresholds = value;
},
SET_BASERATE(state, value) {
state.baseRate = value;
},
SET_FUNDINGREQUEST(state, value) {
state.fundingRequest = value;
},
Expand Down Expand Up @@ -147,6 +150,7 @@ const actions = {
async loadThresholds({ commit }, academicYear) {
axios.get(`${CSG_THRESHOLD_URL}/${academicYear}`).then((resp) => {
commit("SET_THRESHOLDS", resp.data.data);
commit("SET_BASERATE", resp.data.rates.csg_dep_monthly_amount);
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const state = {
disbursements: [],
parentAssessment: {},
parentDisbursements: [],
baseRate: 2800,
baseRate: 0.00,
};
const getters = {
previousDisbursements(state) {
Expand Down Expand Up @@ -40,6 +40,9 @@ const mutations = {
SET_THRESHOLDS(state, value) {
state.csgThresholds = value;
},
SET_BASERATE(state, value) {
state.baseRate = value;
},
SET_FUNDINGREQUEST(state, value) {
state.fundingRequest = value;
},
Expand Down Expand Up @@ -71,6 +74,7 @@ const actions = {
async loadThresholds({ commit }, academicYear) {
axios.get(`${CSG_THRESHOLD_URL}/${academicYear}`).then((resp) => {
commit("SET_THRESHOLDS", resp.data.data);
commit("SET_BASERATE", resp.data.rates.csg_pd_yearly_amount);
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const state = {
disbursements: [],
parentAssessment: {},
parentDisbursements: [],
baseRate: 525,
baseRate: 0.00,
};
const getters = {
familyIncome(state) {
Expand Down Expand Up @@ -117,6 +117,9 @@ const mutations = {
SET_THRESHOLDS(state, value) {
state.csgThresholds = value;
},
SET_BASERATE(state, value) {
state.baseRate = value;
},
SET_FUNDINGREQUEST(state, value) {
state.fundingRequest = value;
},
Expand Down Expand Up @@ -148,6 +151,7 @@ const actions = {
async loadThresholds({ commit }, academicYear) {
axios.get(`${CSG_THRESHOLD_URL}/${academicYear}`).then((resp) => {
commit("SET_THRESHOLDS", resp.data.data);
commit("SET_BASERATE", resp.data.rates.csg_8_month_amount / 8);
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const state = {
disbursements: [],
parentAssessment: {},
parentDisbursements: [],
baseRate: 200,
baseRate: 200, // hardcoded as it is not stored in the database yet
};
const getters = {
previousDisbursements(state) {
Expand Down
Loading

0 comments on commit bcde134

Please sign in to comment.