WIP Audit Changes

This commit is contained in:
Patrick Fic
2024-04-18 17:05:49 -07:00
parent cf14111a73
commit 49c28c2f6b
8 changed files with 203 additions and 48 deletions

View File

@@ -5,6 +5,7 @@ const INITIAL_STATE = {
scoreCard: null,
error: null,
loading: false,
audit: {}
};
const applicationReducer = (state = INITIAL_STATE, action) => {
@@ -16,18 +17,20 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
error: null,
dates: {
startDate: action.payload.startDate.toISOString(),
endDate: action.payload.endDate.toISOString(),
},
endDate: action.payload.endDate.toISOString()
}
};
case ReportingActionTypes.SET_REPORTING_ERROR:
return {
...state,
error: action.payload,
error: action.payload
};
case ReportingActionTypes.SET_REPORTING_DATA:
return { ...state, data: action.payload };
case ReportingActionTypes.SET_SCORE_CARD:
return { ...state, loading: false, scoreCard: action.payload };
case ReportingActionTypes.SET_AUDIT_RESULTS:
return { ...state, loading: false, audit: action.payload };
case ReportingActionTypes.TOGGLE_GROUP_VERIFIED:
return {
...state,
@@ -37,7 +40,7 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
} else {
return d;
}
}),
})
};
default:
return state;

View File

@@ -6,7 +6,13 @@ import { REPORTING_GET_JOBS } from "../../graphql/reporting.queries";
import ipcTypes from "../../ipc.types";
import { CalculateJobRpsDollars, CalculateJobRpsPc } from "../../util/CalculateJobRps";
import GetJobTarget from "../../util/GetJobTarget";
import { calculateScorecard, setReportingData, setScoreCard, setReportingError } from "./reporting.actions";
import {
calculateScorecard,
setReportingData,
setScoreCard,
setReportingError,
setAuditResults
} from "./reporting.actions";
import ReportingApplicationTypes from "./reporting.types";
const { log, ipcRenderer } = window;
@@ -53,35 +59,24 @@ export function* handleCalculateAudit({ payload: claimsArrayFromAudit }) {
claimsArrayHashObject[cleansedClaimNo] = claim;
});
const JobsThatDontMatch = [];
let expectedMismatch = [];
let actualMismatch = [];
rpsJobs.forEach((rpsJob) => {
const matchingAuditJob = claimsArrayHashObject[rpsJob.clm_no];
if (!matchingAuditJob) {
return;
}
if (Math.abs(rpsJob.expectedRpsDollars.getAmount() / 100 - matchingAuditJob.expected_rps_dollars) > 0.01) {
let styles =
"font-weight: bold; font-size: 22px;color: yellow; 6px 6px 0 rgb(226,91,14) , 9px 9px 0 rgb(245,221,8) , 12px 12px 0 rgb(5,148,68) ";
console.log(
"%c %s",
styles,
`Expected Savings Mismatch for ${rpsJob.clm_no} || ${rpsJob.expectedRpsDollars.toFormat()} >> ${
matchingAuditJob.expected_rps_dollars
}`
);
expectedMismatch.push({ clm_no: rpsJob.clm_no, rps: rpsJob, audit: matchingAuditJob });
}
if (Math.abs(rpsJob.jobRpsDollars.getAmount() / 100 - matchingAuditJob.actual_rps_dollars) > 0.01) {
let styles =
"font-weight: bold; font-size: 22px;color: red; 6px 6px 0 rgb(226,91,14) , 9px 9px 0 rgb(245,221,8) , 12px 12px 0 rgb(5,148,68) ";
console.log(
"%c %s",
styles,
`Actual Savings Mismatch for ${rpsJob.clm_no} || ${rpsJob.jobRpsDollars.toFormat()} >> ${
matchingAuditJob.actual_rps_dollars
}`
);
actualMismatch.push({ clm_no: rpsJob.clm_no, rps: rpsJob, audit: matchingAuditJob });
}
});
yield put(setAuditResults({ missingFromRps, missingFromAudit, expectedMismatch, actualMismatch }));
}
export function* onCalculateScoreCard() {

View File

@@ -22,6 +22,10 @@ export const selectReportData = createSelector(
[selectReporting],
(reporting) => reporting.data
);
export const selectAuditData = createSelector(
[selectReporting],
(reporting) => reporting.audit
);
// export const selectWatchedPaths = createSelector(
// [selectReporting],