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

Save an Activity Report #102

Merged
merged 23 commits into from
Jan 15, 2021
Merged

Save an Activity Report #102

merged 23 commits into from
Jan 15, 2021

Conversation

SarahJaine
Copy link
Collaborator

@SarahJaine SarahJaine commented Dec 23, 2020

@jasalisbury is the author of this PR

Description of change

Add the ability to save, retrieve and update an Activity Report. Also provides an endpoint the frontend will need to complete an Activity Report (activity-report/participants). Activity Reports use the Activity Participants table to join to many grants or non-grantees. This PR only contains backend changes. Frontend changes are coming in a separate PR.

  • DB tables added for ActivityReports, ActivityParticipants and NonGrantees
  • API documentation updated
  • Adds two helpers to the lib folder so controllers don't have to directly talk to the database layer
  • Uses already written seeders for grantees/grants but adds a seeder for non-grantees
  • Add virtual column to grants making {grantee.name} - {grant.number} available as a column

Jest tests are run in parallel by default. This was causing issues for tests that hit the database, as one test would remove items a different test relied on. We are now passing the --runInBand flag to jest so tests run sequentially. After the MVP we may want to look at allowing tests to run in parallel again.

How to test

  1. Pull down changes
  2. Install dependencies
  3. Run migrations and seeders
  4. Run the following against the API
POST http://localhost:3000/api/activity-reports
{
    "activityParticipants": [
        {
            "participantId": 1
        }
    ],
    "participantType": "grantee"
}

Note the ID returned (will probably be 1)

GET http://localhost:3000/api/activity-reports/{id}
PUT http://localhost:3000/api/activity-reports/{id}
{
    "additionalNotes": "notes"
}
GET http://localhost:3000/api/activity-reports/participants

Issue(s)

Checklist

  • Meets issue criteria
  • Code tested
  • Meets accessibility standards (WCAG 2.1 Levels A, AA)
  • Documentation updated

@jasalisbury jasalisbury self-assigned this Jan 14, 2021
@jasalisbury jasalisbury marked this pull request as ready for review January 14, 2021 17:14
Copy link

@dcmcand dcmcand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it and everything performs as advertised. Code looks good to me.

Copy link
Collaborator

@kryswisnaskas kryswisnaskas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very exciting to see this! Great job! 👍

name: {
type: DataTypes.VIRTUAL,
get() {
return `${this.grantee.name} - ${this.number}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

};

const reportObject = {
participantType: 'gratnee',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

@jasalisbury jasalisbury merged commit 270b8b2 into main Jan 15, 2021
@jasalisbury jasalisbury deleted the sj-activity-report branch January 15, 2021 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants