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

[Prod] Add columns to CSV, add iPD course widget, fix bad data in createdVia columns #2229

Merged
merged 27 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aa530b7
Start adding missing data to CSV
thewatermethod Jun 12, 2024
444f98e
Updated CSV
thewatermethod Jun 17, 2024
c7fd9c6
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2617/add-re…
thewatermethod Jun 18, 2024
22a3b55
Remove console.logs
thewatermethod Jun 18, 2024
d3949c1
Update unit tests
thewatermethod Jun 18, 2024
9ea2b8d
Remove unused array
thewatermethod Jun 18, 2024
b924fef
Add uniq to fei root causes as well
thewatermethod Jun 18, 2024
85a3557
initial stages
nvms Jun 21, 2024
5408e13
Fix bad created via and remove path
thewatermethod Jun 21, 2024
8982f1d
Fix bugs and add additional tests
thewatermethod Jun 21, 2024
660e0ee
Fix missing data in test
thewatermethod Jun 21, 2024
8a38fe3
sql for course count
nvms Jun 24, 2024
5a41996
format number correctly
nvms Jun 24, 2024
ceb6672
update tests
nvms Jun 24, 2024
20ef7a7
push to sandbox
nvms Jun 24, 2024
eb18db7
fix tests
nvms Jun 24, 2024
6d09238
spacing
nvms Jun 24, 2024
4eda3c1
fix test
nvms Jun 24, 2024
5223130
update import
nvms Jun 24, 2024
091362d
Pull out the support type
thewatermethod Jun 24, 2024
d9e30a8
Merge pull request #2205 from HHS/mb/TTAHUB-2617/add-records-to-csv
thewatermethod Jun 25, 2024
dbd49a5
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3027/fix-cr…
thewatermethod Jun 25, 2024
c6e2ee9
Rename migration
thewatermethod Jun 25, 2024
e8b3f5d
Merge pull request #2222 from HHS/jp/3005/ipd-courses-widget
nvms Jun 25, 2024
db6705c
Merge pull request #2223 from HHS/mb/TTAHUB-3027/fix-created-vias
thewatermethod Jun 25, 2024
1e873dc
swap order
nvms Jun 25, 2024
32b7293
Merge pull request #2231 from HHS/jp/flip-course-routes
nvms Jun 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ parameters:
default: "mb/TTAHUB-3007/no-disallowed-urls"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "al-ttahub-add-fei-root-cause-to-review"
default: "jp/3005/ipd-courses-widget"
type: string
prod_new_relic_app_id:
default: "877570491"
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/pages/ResourcesDashboard/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ const resourcesDefault = {
participant: {
numParticipants: '765',
},
ipdCourses: {
percentReports: '4.65%',
},
},
resourcesUse: {
headers: ['Jan-22'],
Expand Down Expand Up @@ -116,6 +119,9 @@ const resourcesRegion1 = {
participant: {
numParticipants: '665',
},
ipdCourses: {
percentReports: '4.65%',
},
},
resourcesUse: {
headers: ['Jan-22'],
Expand Down Expand Up @@ -183,6 +189,9 @@ const resourcesRegion2 = {
participant: {
numParticipants: '565',
},
ipdCourses: {
percentReports: '4.65%',
},
},
resourcesUse: {
headers: ['Jan-22'],
Expand Down Expand Up @@ -442,6 +451,10 @@ describe('Resource Dashboard page', () => {
expect(screen.getAllByText(/^[ \t]*reports with resources[ \t]*$/i)[0]).toBeInTheDocument();
expect(screen.getByText(/6,135 of 17,914/i)).toBeInTheDocument();

// iPD courses
expect(screen.getByText(/4.65%/i)).toBeInTheDocument();
expect(screen.getAllByText(/^[ \t]*reports citing ipd courses[ \t]*$/i)[0]).toBeInTheDocument();

expect(screen.getByText(/.66%/i)).toBeInTheDocument();
expect(screen.getAllByText(/^[ \t]*eclkc resources[ \t]*$/i)[0]).toBeInTheDocument();
expect(screen.getByText(/818 of 365/i)).toBeInTheDocument();
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/ResourcesDashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export default function ResourcesDashboard() {
'ECLKC Resources',
'Recipients reached',
'Participants reached',
'Reports citing iPD courses',
]}
showTooltips
/>
Expand Down
44 changes: 42 additions & 2 deletions frontend/src/widgets/ResourcesDashboardOverview.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Grid } from '@trussworks/react-uswds';
import { Link } from 'react-router-dom';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faLink, faCube, faUser, faUserFriends,
faLink,
faCube,
faUser,
faUserFriends,
faFolder,
} from '@fortawesome/free-solid-svg-icons';
import './ResourcesDashboardOverview.css';

Expand All @@ -14,6 +19,7 @@ import colors from '../colors';
export function Field({
label1,
label2,
route,
data,
icon,
iconColor,
Expand All @@ -37,8 +43,15 @@ export function Field({
buttonLabel={`${tooltipText} click to visually reveal this information`}
tooltipText={tooltipText}
/>
) : label1}
) : (
<span className="margin-top-1">{label1}</span>
)}
{label2}
{route && (
<Link to={route.to} className="margin-top-1">
{route.label}
</Link>
)}
</span>
</Grid>
);
Expand All @@ -58,12 +71,17 @@ Field.propTypes = {
backgroundColor: PropTypes.string.isRequired,
tooltipText: PropTypes.string,
showTooltip: PropTypes.bool,
route: PropTypes.shape({
to: PropTypes.string,
label: PropTypes.string,
}),
};

Field.defaultProps = {
tooltipText: '',
showTooltip: false,
label2: '',
route: null,
};
const DASHBOARD_FIELDS = {
'Reports with resources': {
Expand Down Expand Up @@ -124,6 +142,24 @@ const DASHBOARD_FIELDS = {
/>
),
},
'Reports citing iPD courses': {
render: (data) => (
<Field
key="reports-citing-ipd-courses"
icon={faFolder}
showTooltip={false}
label1="Reports citing iPD courses"
iconColor={colors.baseDark}
backgroundColor={colors.baseLightest}
tooltipText="Total participants of ARs that cite at least one resource"
data={data.ipdCourses.percentReports}
route={{
to: '/dashboards/ipd-courses',
label: 'Display details',
}}
/>
),
},
};

export function ResourcesDashboardOverviewWidget({
Expand Down Expand Up @@ -180,6 +216,9 @@ ResourcesDashboardOverviewWidget.defaultProps = {
participant: {
numParticipants: '0',
},
ipdCourses: {
percentReports: '0%',
},
},
loading: false,
showTooltips: false,
Expand All @@ -188,6 +227,7 @@ ResourcesDashboardOverviewWidget.defaultProps = {
'ECLKC Resources',
'Recipients reached',
'Participants reached',
'Reports citing iPD courses',
],
};

Expand Down
28 changes: 21 additions & 7 deletions frontend/src/widgets/__tests__/ResourcesDashboardOverview.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
/* eslint-disable jest/no-disabled-tests */
import '@testing-library/jest-dom';
import React from 'react';
import { Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import { render, screen } from '@testing-library/react';
import { ResourcesDashboardOverviewWidget } from '../ResourcesDashboardOverview';

const renderResourcesDashboardOverview = (props) => (
render(<ResourcesDashboardOverviewWidget loading={props.loading} data={props.data} />)
);
const renderResourcesDashboardOverview = (props) => {
const history = createMemoryHistory();

render(
<Router history={history}>
<ResourcesDashboardOverviewWidget loading={props.loading} data={props.data} />
</Router>,
);
};

describe('Resource Dashboard Overview Widget', () => {
it('handles undefined data', async () => {
Expand All @@ -16,6 +24,7 @@ describe('Resource Dashboard Overview Widget', () => {
expect(screen.getByText(/eclkc resources/i)).toBeInTheDocument();
expect(screen.getByText(/recipients reached/i)).toBeInTheDocument();
expect(screen.getByText(/participants reached/i)).toBeInTheDocument();
expect(screen.getByText(/reports citing ipd courses/i)).toBeInTheDocument();
});

it('shows the correct data', async () => {
Expand All @@ -36,14 +45,19 @@ describe('Resource Dashboard Overview Widget', () => {
participant: {
numParticipants: '765',
},
ipdCourses: {
percentReports: '88.88%',
},
};

renderResourcesDashboardOverview({ data });
expect(await screen.findByText(/^[ \t]*reports with resources\r?\n?[ \t]*8,135 of 19,914/i)).toBeVisible();
expect(await screen.findByText(/^[ \t]*eclkc resources\n?[ \t]*1,819 of 2,365/i)).toBeVisible();
expect(await screen.findByText(/248/i)).toBeVisible();
expect(await screen.findByText(/8,135 of 19,914/)).toBeVisible();
expect(await screen.findByText(/1,819 of 2,365/)).toBeVisible();
expect(await screen.findByText(/248/)).toBeVisible();
expect(await screen.findByText(/recipients reached/i)).toBeVisible();
expect(await screen.findByText(/765/i)).toBeVisible();
expect(await screen.findByText(/765/)).toBeVisible();
expect(await screen.findByText(/participants reached/i)).toBeVisible();
expect(await screen.findByText(/88.88%/)).toBeVisible();
expect(await screen.findByText(/reports citing ipd courses/i)).toBeVisible();
});
});
2 changes: 1 addition & 1 deletion src/goalServices/createOrUpdateGoals.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('createOrUpdateGoals', () => {
status: 'Draft',
grantId: grants[0].id,
source: GOAL_SOURCES[0],
createdVia: 'activityReport',
});

objective = await Objective.create({
Expand Down Expand Up @@ -113,7 +114,6 @@ describe('createOrUpdateGoals', () => {
grantId: goal.grantId,
status: 'Draft',
};

newGoals = await createOrUpdateGoals([
{
...basicGoal,
Expand Down
5 changes: 1 addition & 4 deletions src/goalServices/goals.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ export async function createOrUpdateGoals(goals) {
status: 'Draft', // if we are creating a goal for the first time, it should be set to 'Draft'
isFromSmartsheetTtaPlan: false,
rtrOrder: rtrOrder + 1,
createdVia: 'rtr',
});
}

Expand All @@ -504,10 +505,6 @@ export async function createOrUpdateGoals(goals) {
if (newGoal.status !== status) {
newGoal.set({ status });
}

if (!newGoal.createdVia || newGoal.createdVia !== createdVia) {
newGoal.set({ createdVia: createdVia || (newGoal.isFromSmartsheetTtaPlan ? 'imported' : 'rtr') });
}
}

// end date and source can be updated if the goal is not closed
Expand Down
Loading