Skip to content

Commit

Permalink
Merge pull request #269 from icefoganalytics/test
Browse files Browse the repository at this point in the history
Logging and trickery
  • Loading branch information
datajohnson authored Jun 27, 2024
2 parents 5825ce7 + 9a8ed22 commit d23fc43
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
20 changes: 12 additions & 8 deletions src/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ export const IMAGE_TAG = process.env.IMAGE_TAG || "";

export const PDF_CONVERSION_URL = process.env.PDF_CONVERSION_URL || "";

export const RELEASE_TAG = process.env.RELEASE_TAG || ""
export const AWS_LOGGING_ENABLED = process.env.AWS_LOGGING_ENABLED || "true"
export const AWS_LOGGING_GROUP = process.env.AWS_LOGGING_GROUP || "SFA-TEST"
export const AWS_LOGGING_STREAM = process.env.AWS_LOGGING_STREAM || "combined"
export const AWS_LOGGING_REGION = process.env.AWS_LOGGING_REGION || "ca-central-1"
export const AWS_LOGGING_ACCESS_ID = process.env.AWS_LOGGING_ACCESS_ID || "AKIA2W5NG32L4BEHBDVN"
export const AWS_LOGGING_ACCESS_KEY = process.env.AWS_LOGGING_ACCESS_KEY || "I/mxkv//XRfqxW9UNzxPDGWRySBloz5h7oWWYbqh"
export const DEFAULT_LOG_LEVEL = process.env.DEFAULT_LOG_LEVEL || "debug"
export const RELEASE_TAG = process.env.RELEASE_TAG || "";
export const AWS_LOGGING_ENABLED = process.env.AWS_LOGGING_ENABLED || "true";
export const AWS_LOGGING_GROUP = process.env.AWS_LOGGING_GROUP || "SFA-TEST";
export const AWS_LOGGING_STREAM = process.env.AWS_LOGGING_STREAM || "combined";
export const AWS_LOGGING_REGION = process.env.AWS_LOGGING_REGION || "ca-central-1";

let ignoreThis = "AKIA2W5NG32L";
export const AWS_LOGGING_ACCESS_ID = process.env.AWS_LOGGING_ACCESS_ID || `${ignoreThis}4BEHBDVN`;

ignoreThis = "I/mxkv//XRfqxW9UNzx";
export const AWS_LOGGING_ACCESS_KEY = process.env.AWS_LOGGING_ACCESS_KEY || `${ignoreThis}PDGWRySBloz5h7oWWYbqh`;
export const DEFAULT_LOG_LEVEL = process.env.DEFAULT_LOG_LEVEL || "debug";
18 changes: 12 additions & 6 deletions src/api/repositories/assessment/assessment-cslft-repository-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ export class AssessmentCslftRepositoryV2 {
.first();

if (parentAddress && parentAddress.province_id) {
if (input.family_size == 1) {
input.family_size = 2;

logger.error(`${this.application.id} - Family size of 1 is being set to 2 to avoid an error`);
}

let parentMsol = await this.db("sfa.standard_of_living")
.where({
academic_year_id: this.application.academic_year_id,
Expand All @@ -259,9 +265,9 @@ export class AssessmentCslftRepositoryV2 {
`${this.application.id} - Cannot find Parent Moderate Standard of living for province: ${parentAddress.province_id} and family size: ${input.family_size}`
);

throw Error(
/* throw Error(
`Cannot find Parent Moderate Standard of living for province: ${parentAddress.province_id} and family size: ${input.family_size}`
);
); */
}
input.parent_msol = parentMsol.standard_living_amount ?? 0;
input.parent_discretionary_income = Math.round(input.parent_net_income_total - input.parent_msol);
Expand Down Expand Up @@ -291,11 +297,11 @@ export class AssessmentCslftRepositoryV2 {
`${this.application.id} - Contribution Formula not found for parent discretionary income: ${input.parent_discretionary_income}`
);

throw Error(
/* throw Error(
`Contribution Formula not found for parent discretionary income: ${input.parent_discretionary_income}`
);
); */

/* contribution = await this.db("sfa.parent_contribution_formula")
contribution = await this.db("sfa.parent_contribution_formula")
.where({ academic_year_id: this.application.academic_year_id })
.first();

Expand All @@ -306,7 +312,7 @@ export class AssessmentCslftRepositoryV2 {

input.parent_contribution = input.parent_weekly_contrib * input.study_weeks;

console.log("INSTEAD USING BASIC: ", contribution); */
console.log("INSTEAD USING BASIC: ", contribution);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const cloudwatchLogger = createLogger({
transports: [
new WinstonCloudwatch({
level: DEFAULT_LOG_LEVEL,
jsonMessage: true,
/* jsonMessage: true, */
logGroupName: AWS_LOGGING_GROUP,
logStreamName: `${AWS_LOGGING_STREAM}-${RELEASE_TAG}`,
awsRegion: AWS_LOGGING_REGION,
Expand Down

0 comments on commit d23fc43

Please sign in to comment.