Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main -> Val #139783

Merged
merged 10 commits into from
Sep 27, 2024
5 changes: 2 additions & 3 deletions .github/workflows/scan_security-hub-jira-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ jobs:
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: ${{ secrets.PRODUCTION_SYNC_OIDC_ROLE }}
- name: Sync Security Hub and Jira
uses: Enterprise-CMCS/mac-fc-security-hub-visibility@v1.0.5
uses: Enterprise-CMCS/mac-fc-security-hub-visibility@v2.0.9
with:
jira-username: "mdct_github_service_account"
jira-token: ${{ secrets.JIRA_ENT_USER_TOKEN }}
jira-host: jiraent.cms.gov
jira-project-key: CMDCT
jira-ignore-statuses: Done, Closed, Canceled
jira-custom-fields: '{ "customfield_10100": "CMDCT-2280", "customfield_26700" : [{"id": "40101", "value": "CARTS"}] }'
aws-severities: CRITICAL, HIGH, MEDIUM
assign-jira-ticket-to: "MWTW"
jira-assignee: "MWTW"
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
exclude: 'seed-section-base-*'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
Expand Down
2 changes: 1 addition & 1 deletion services/app-api/handlers/fiscalYearTemplate/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import s3 from "../../libs/s3-lib";
import { ReportPdfs } from "../../types";

export const getFiscalYearTemplateLink = handler(async (_context) => {
const filename = ReportPdfs[2023];
const filename = ReportPdfs[2024];
const url = await s3.getSignedDownloadUrl(
{
Bucket:
Expand Down
1 change: 1 addition & 0 deletions services/app-api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export const ReportPdfs = {
2021: "FFY_2021_CARTS_Template.pdf",
2022: "FFY_2022_CARTS_Template.pdf",
2023: "FFY_2023_CARTS_Template.pdf",
2024: "FFY_2024_CARTS_Template.pdf",
};
/* eslint-enable no-unused-vars */

Expand Down
10,736 changes: 10,736 additions & 0 deletions services/database/data/seed/seed-section-base-2024.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions services/database/handlers/seed/tables/sectionBase.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const sectionData = [
...require("../../../data/seed/seed-section-base-2022.json"),
...require("../../../data/seed/seed-section-base-2023.json"),
...require("../../../data/seed/seed-section-base-2024.json"),
];

const seed = {
Expand Down
2 changes: 1 addition & 1 deletion services/ui-src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"sass": "^1.77.1",
"vite": "^5.2.11",
"vite": "^5.4.6",
"vite-tsconfig-paths": "^4.3.2"
},
"scripts": {
Expand Down
14 changes: 6 additions & 8 deletions services/ui-src/src/components/fields/Integer.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React, { useState } from "react";
import PropTypes from "prop-types";
import { TextField } from "@cmsgov/design-system";
import { useSelector } from "react-redux";
import { TextField } from "@cmsgov/design-system";
//utils
import { generateQuestionNumber } from "../utils/helperFunctions";
import { lteMask } from "../../util/constants";
//types
import PropTypes from "prop-types";

const getPrevYearValue = (question, lastYearFormData) => {
let prevYearValue;
Expand Down Expand Up @@ -68,12 +71,7 @@ const Integer = ({ onChange, question, prevYear, printView, ...props }) => {
};

const isLessThanElevenMask = (value) => {
return (
printView &&
question.mask === "lessThanEleven" &&
value <= 10 &&
value > 0
);
return printView && question.mask === lteMask && value <= 10 && value > 0;
};

const renderAnswer = () => {
Expand Down
14 changes: 9 additions & 5 deletions services/ui-src/src/components/fields/Integer.test.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import React from "react";
import { Provider } from "react-redux";
import configureMockStore from "redux-mock-store";
//testing
import { shallow, mount } from "enzyme";
import Integer from "./Integer";
import configureMockStore from "redux-mock-store";
import { screen, render, fireEvent } from "@testing-library/react";
//components
import Integer from "./Integer";
//utils
import { lteMask } from "../../util/constants";

const mockStore = configureMockStore();
const lastYearFormData = [
Expand Down Expand Up @@ -114,7 +118,7 @@ describe("<Integer />", () => {
id: "2023-00-a-01-01",
label: "Example Question",
answer: { entry: "5" },
mask: "lessThanEleven",
mask: lteMask,
},
printView: true,
};
Expand All @@ -130,7 +134,7 @@ describe("<Integer />", () => {
id: "2023-00-a-01-01",
label: "Example Question",
answer: { entry: "12" },
mask: "lessThanEleven",
mask: lteMask,
},
printView: true,
};
Expand All @@ -145,7 +149,7 @@ describe("<Integer />", () => {
id: "2023-00-a-01-01",
label: "Example Question",
answer: { entry: "0" },
mask: "lessThanEleven",
mask: lteMask,
},
printView: true,
};
Expand Down
23 changes: 17 additions & 6 deletions services/ui-src/src/components/fields/SynthesizedTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import React from "react";
import { useSelector, shallowEqual } from "react-redux";
//utils
import synthesizeValue from "../../util/synthesize";
import { lteMask } from "../../util/constants";
//types
import PropTypes from "prop-types";

const SynthesizedTable = ({ question, tableTitle }) => {
const SynthesizedTable = ({ question, tableTitle, printView }) => {
const [allStatesData, stateName, stateUserAbbr, chipEnrollments, formData] =
useSelector(
(state) => [
Expand All @@ -18,8 +19,12 @@ const SynthesizedTable = ({ question, tableTitle }) => {
shallowEqual
);

const rows = question.fieldset_info.rows.map((row) =>
row.map((cell) => {
const rows = question.fieldset_info.rows.map((row) => {
let contents = row;
if (printView) {
contents = row.filter((cell) => cell?.mask !== lteMask);
}
return contents.map((cell) => {
const value = synthesizeValue(
cell,
allStatesData,
Expand All @@ -32,8 +37,14 @@ const SynthesizedTable = ({ question, tableTitle }) => {
return typeof value.contents === "number" && Number.isNaN(value.contents)
? { contents: "Not Available" }
: value;
})
);
});
});

const headers = printView
? question.fieldset_info.headers.filter(
(header) => header?.mask !== lteMask
)
: question.fieldset_info.headers;

return (
<div className="synthesized-table ds-u-margin-top--2">
Expand All @@ -48,7 +59,7 @@ const SynthesizedTable = ({ question, tableTitle }) => {
>
<thead>
<tr>
{question.fieldset_info.headers.map((header, index) => (
{headers.map((header, index) => (
<th scope="col" key={index}>
{header.contents}
</th>
Expand Down
139 changes: 139 additions & 0 deletions services/ui-src/src/components/fields/SynthesizedTable.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import React from "react";
import { Provider } from "react-redux";
import { screen, render } from "@testing-library/react";
import configureMockStore from "redux-mock-store";
import { lteMask } from "../../util/constants";
import SynthesizedTable from "./SynthesizedTable";

const mockStore = configureMockStore();
const store = mockStore({
formData: [
{
contents: {
section: {
year: 2023,
state: "AL",
},
},
},
],
global: {
stateName: "AL",
},
stateUser: {
abbr: "CMS",
},
enrollmentCounts: {
chipEnrollments: 0,
},
lastYearFormData: [],
lastYearTotals: {},
});

const defaultProps = {
tableTitle: "Managed Care Costs",
question: {
questions: [],
fieldset_info: {
rows: [
[
{
contents: "Eligible children",
},
{
actions: ["identity"],
targets: ["$..*[?(@ && @.id=='2023-05-a-03-01-a')].answer.entry"],
},
{
actions: ["identity"],
targets: ["$..*[?(@ && @.id=='2023-05-a-03-01-b')].answer.entry"],
},
],
],
headers: [
{
contents: "",
},
{
contents: "FFY 2023",
},
{
contents: "FFY 2024",
},
],
},
fieldset_type: "synthesized_table",
type: "fieldset",
},
};

const SynthesizedTableComponentWithProps = (testSpecificProps) => {
return (
<Provider store={store}>
<SynthesizedTable {...defaultProps} {...testSpecificProps} />
</Provider>
);
};

describe("<SynthesizedTable />", () => {
test("should render header and labels", () => {
render(SynthesizedTableComponentWithProps());

expect(screen.getByText("FFY 2023")).toBeInTheDocument();
expect(screen.getByText("FFY 2024")).toBeInTheDocument();
expect(screen.getByText("Eligible children")).toBeInTheDocument();
});

test("should not render in print view with lessThanEleven mask prop", () => {
render(
SynthesizedTableComponentWithProps({
question: {
...defaultProps.question,
fieldset_info: {
rows: [
[
{
contents: "Eligible children",
mask: lteMask,
},
{
mask: lteMask,
actions: ["identity"],
targets: [
"$..*[?(@ && @.id=='2023-05-a-03-01-a')].answer.entry",
],
},
{
mask: lteMask,
actions: ["identity"],
targets: [
"$..*[?(@ && @.id=='2023-05-a-03-01-b')].answer.entry",
],
},
],
],
headers: [
{
mask: lteMask,
contents: "",
},
{
mask: lteMask,
contents: "FFY 2023",
},
{
mask: lteMask,
contents: "FFY 2024",
},
],
},
},
printView: true,
})
);

expect(screen.queryByText("FFY 2023")).not.toBeInTheDocument();
expect(screen.queryByText("FFY 2024")).not.toBeInTheDocument();
expect(screen.queryByText("Eligible children")).not.toBeInTheDocument();
});
});
38 changes: 22 additions & 16 deletions services/ui-src/src/components/fields/SynthesizedValue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { useSelector, shallowEqual } from "react-redux";
import Question from "./Question";
//utils
import synthesizeValue from "../../util/synthesize";
import { lteMask } from "../../util/constants";
//types
import PropTypes from "prop-types";

const SynthesizedValue = ({ question, ...props }) => {
const SynthesizedValue = ({ question, printView, ...props }) => {
const [allStatesData, stateName, stateUserAbbr, chipEnrollments, formData] =
useSelector(
(state) => [
Expand All @@ -20,23 +21,28 @@ const SynthesizedValue = ({ question, ...props }) => {
shallowEqual
);

const value = synthesizeValue(
question.fieldset_info,
allStatesData,
stateName,
stateUserAbbr,
chipEnrollments,
formData
).contents;
const showValue = !(printView && question.fieldset_info.mask === lteMask);
const renderValue = () => {
return synthesizeValue(
question.fieldset_info,
allStatesData,
stateName,
stateUserAbbr,
chipEnrollments,
formData
).contents;
};

return (
<div>
<strong>Computed:</strong> {value}
{question.questions &&
question.questions.map((q) => (
<Question key={q.id} question={q} {...props} />
))}
</div>
showValue && (
<div>
<strong>Computed:</strong> {renderValue()}
{question.questions &&
question.questions.map((q) => (
<Question key={q.id} question={q} {...props} />
))}
</div>
)
);
};
SynthesizedValue.propTypes = {
Expand Down
Loading
Loading