-
Notifications
You must be signed in to change notification settings - Fork 7
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
Saving an activity report #254
Conversation
Grants/grantees are already seeded, changing participants to just be nonGrantees
This reverts commit fddb56b.
…TTADP into sj-activity-report
…Start-TTADP into kw-session-store
Save an Activity Report
Add activity reports/participants and nongrantees to model
@jasalisbury I'll take a look at this soon, or first thing Monday. Does this complete 98 or is there something else to do on it before we can close it out? |
#98 will still need adhocteam#118 before it can be closed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit concerned about the overloaded naming around participants. Did I interpret what's going on correctly?
package.json
Outdated
@@ -18,7 +18,7 @@ | |||
"server:debug": "nodemon src/index.js --exec babel-node --inspect", | |||
"client": "yarn --cwd frontend start", | |||
"test": "jest src", | |||
"test:ci": "cross-env JEST_JUNIT_OUTPUT_DIR=reports JEST_JUNIT_OUTPUT_NAME=unit.xml POSTGRES_USERNAME=postgres POSTGRES_DB=ttasmarthub CURRENT_USER_ID=5 CI=true jest src tools --coverage --reporters=default --reporters=jest-junit", | |||
"test:ci": "cross-env JEST_JUNIT_OUTPUT_DIR=reports JEST_JUNIT_OUTPUT_NAME=unit.xml POSTGRES_USERNAME=postgres POSTGRES_DB=ttasmarthub CURRENT_USER_ID=5 CI=true jest src tools --runInBand --coverage --reporters=default --reporters=jest-junit", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can runInBand
be removed? To me this is a smell that we have some un-declared dependencies that should be cleaned up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue is when tests run in parallel they are independently inserting and removing items from the DB, which causes races within tests. I can spend some time trying to see if there are any obvious offenders but it may be a task better suited to after the MVP.
allowNull: true, | ||
type: Sequelize.DATEONLY, | ||
}, | ||
participantType: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for Grantees vs. NonGrantees? I'm feeling some naming confusion over this field vs. participants
and numberOfParticipants
.
I wonder if we even need to store this vs figuring it out from the ActivityParticipants relationships
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is for Grant vs NonGrantee. We probably could get away with not storing it but it feels easier to store it here instead of looking at the ActivityParticipants
relationship. Although the only time we'll need to look it up is when retrieving activity reports. Creates and updates would stay pretty much the same.
I agree with the naming confusion but couldn't come up with a bettername for grant
or nonGrantee
. Best I could think of (and this isn't a good name at all!) is subjects
, which also seems a bit overloaded.
@@ -0,0 +1,53 @@ | |||
module.exports = { | |||
up: async (queryInterface, Sequelize) => { | |||
queryInterface.createTable('ActivityParticipants', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda similar naming confusion here. I was thinking of Participants as individual people, or roles at the grantee that were at the activity. The PR is using participants for both that as well as the Grantee(s) or NonGrantee(s)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree it is confusing, I just lived with the confusion enough that I forgot about it! I'll ping the other engineers and try to come up with a better name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about renaming ActivityParticipants
to ActivityReceivers
or ActivityRecipients
?
import { | ||
reportParticipants, activityReportById, createOrUpdate, reportExists, | ||
} from '../../services/activityReports'; | ||
import { userById, usersWithPermissions } from '../../services/users'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ pulling these into services.
Remove `--runInBand`, it appears to no longer be needed to prevent a race with tests that hit the database
…into kw-session-store
Change express-session to cookie-session
Found a test that was removing all request errors, which was causing failures when tests were run in parrallel. Was able to update the test enabling parallel test runs
…back Saving an activity report feedback
This PR now also includes work for this ticket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
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.ActivityReports
,ActivityParticipants
andNonGrantees
services
folder so controllers don't have to directly talk to the database layer{grantee.name} - {grant.number}
available as a columnJest 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
Note the ID returned (will probably be 1)
Issue(s)
express-session
#73Checklist