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

Tbolt/3298 affiliation expiration #3360

Merged
merged 28 commits into from
Sep 13, 2021
Merged

Conversation

tbolt
Copy link
Contributor

@tbolt tbolt commented Aug 2, 2021

Resolves #3298

Description-

  • No UI updates with this story. Backend updates include:
    • Updates the affiliations table to have an expires_at column
    • Sets all existing affiliation expires_at dates based on acceptance criteria
    • When a new affiliation is approved it will set the expiration date based on acceptance criteria

Acceptance criteria

Given When Then
a regular state user they are approved set their expiration date to 1 year from today
a state admin user they are approved set their expiration date to June 30th of the next year

Steps to manually verify this change...
I believe the only way to verify this change would be to have a build running locally and inspect the database after approving new affiliations

  1. Login as Fed Admin and approve a State Admin role
  2. Verify the expiration date is June 30th 2022 in the database
  3. Login as a State Admin and approve both a State Contractor and State Coordinator
  4. Verify the expiration date is 1 year from today in the database

This pull request is ready to review when...

  • Automated tests are updated (and all tests are passing)
  • The change has been documented
  • Associated OpenAPI documentation has been updated
  • Changelog is updated as appropriate
  • The experience passes a basic manual accessibility audit (keyboard nav, screenreader, text scaling) OR an exemption is documented

This pull request can be merged when…

  • Code has been reviewed by someone other than the original author
  • QA has verified the accessibility and functionality related to the change
  • Design has approved the experience
  • Product has approved the experience

@tbolt tbolt requested review from thetif and knollfear August 2, 2021 20:13
@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2021

Codecov Report

Merging #3360 (037a82d) into development (bfb4d72) will decrease coverage by 0.29%.
The diff coverage is 30.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #3360      +/-   ##
===============================================
- Coverage        88.96%   88.67%   -0.30%     
===============================================
  Files              282      282              
  Lines             5583     5589       +6     
  Branches          1071     1071              
===============================================
- Hits              4967     4956      -11     
- Misses             563      580      +17     
  Partials            53       53              
Impacted Files Coverage Δ
api/db/affiliations.js 59.32% <0.00%> (-6.72%) ⬇️
api/routes/affiliations/patch.js 92.30% <100.00%> (ø)
api/files/local.js 38.09% <0.00%> (-52.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfb4d72...037a82d. Read the comment docs.

@cms-eapd-bot
Copy link

cms-eapd-bot commented Aug 2, 2021

This deploy was cleaned up.

@tbolt tbolt marked this pull request as draft August 3, 2021 14:07
@tbolt tbolt marked this pull request as ready for review August 3, 2021 17:24
@thetif
Copy link
Contributor

thetif commented Aug 4, 2021

I'm getting this error when I try to approve a user as a fed admin
Screen Shot 2021-08-04 at 4 00 29 PM

const audit = auditor(statusToAction(status), request);


// Lookup role name and set expiration date accordingly
Copy link
Contributor Author

@tbolt tbolt Aug 5, 2021

Choose a reason for hiding this comment

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

@thetif @knollfear I thought this would work but there's a problem with my approach here: We pass in -1 as the roleId when we are revoking or denying a role. So ill come up with a better way to handle that case. open to ideas

Also do we want to not set an expiration date when roles are denied/revoked?

Edit: Also, is there a way I can add tests for this? We don't return anything in the response, so either I would have to check the database or do another GET, both seem like weird patterns though.

Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion if the role is revoked we can leave the expiration alone. If they are later reinstated, we should be sure not to (I think) extend their expiration date.

As for testing this, you could mock the DB calls and then assert that they had in fact been called. However, I think we are moving to a "live" test DB so mocking it for a week or 2 might be unnecessary.

@thetif
Copy link
Contributor

thetif commented Aug 13, 2021

when I logged in as stateadmin I got this screen, when I clicked ok, it went through to the Alaska dashboard, but we shouldn't be seeing this at all if they only have 1 affiliation

Screen Shot 2021-08-13 at 10 47 50 AM

Actually the user does have two states to choose between, but they aren't showing up. Then when I try to go to the Alaska Dashboard, all of tabs are empty because the get requests fail.

@tbolt tbolt marked this pull request as draft August 13, 2021 15:08
Copy link
Contributor

@knollfear knollfear left a comment

Choose a reason for hiding this comment

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

looks good.

const audit = auditor(statusToAction(status), request);


// Lookup role name and set expiration date accordingly
Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion if the role is revoked we can leave the expiration alone. If they are later reinstated, we should be sure not to (I think) extend their expiration date.

As for testing this, you could mock the DB calls and then assert that they had in fact been called. However, I think we are moving to a "live" test DB so mocking it for a week or 2 might be unnecessary.

api/routes/affiliations/patch.js Outdated Show resolved Hide resolved
api/routes/affiliations/patch.js Outdated Show resolved Hide resolved
api/seeds/shared/set-up-users.js Outdated Show resolved Hide resolved
knollfear and others added 6 commits August 24, 2021 12:24
…lt/3298-affiliation-expiration

� Conflicts:
�	CHANGELOG.md
�	api/routes/affiliations/patch.js
�	api/seeds/shared/set-up-users.js
…ons.js

Co-authored-by: Michael Knoll <42681520+knollfear@users.noreply.github.com>
@tbolt tbolt marked this pull request as ready for review August 24, 2021 20:13
@tbolt tbolt requested a review from knollfear August 25, 2021 11:23
@thetif
Copy link
Contributor

thetif commented Aug 31, 2021

Tested by:

Given When Then Results
an affiliation request a state admin approves them for State Staff their expiration is set to a year from today ✅ PASS
an affiliation request a state admin approves them for State Contractor their expiration is set to a year from today ✅ PASS
an affiliation request a fed admin approves them for State Admin their expiration is set to next June 30th ✅ PASS
an approved affiliation a state admin revokes the affiliation error message on request Cannot destructure property 'name' of '(intermediate value)' as it is undefined. ❌ FAIL
an approved affiliation a fed admin revokes the affiliation error message on request Cannot destructure property 'name' of '(intermediate value)' as it is undefined. ❌ FAIL
an affiliation request a state admin denies it error message on request Cannot destructure property 'name' of '(intermediate value)' as it is undefined. ❌ FAIL
an affiliation request a fed admin denies it error message on request Cannot destructure property 'name' of '(intermediate value)' as it is undefined. ❌ FAIL

@thetif thetif self-assigned this Aug 31, 2021
@tbolt
Copy link
Contributor Author

tbolt commented Sep 1, 2021

@thetif Please re-test. Those issues are resolved now

@thetif
Copy link
Contributor

thetif commented Sep 7, 2021

Tested by:

Given When Then Results
an affiliation request a state admin approves them for State Staff their expiration is set to a year from today ✅ PASS
an affiliation request a state admin approves them for State Contractor their expiration is set to a year from today ✅ PASS
an affiliation request a fed admin approves them for State Admin their expiration is set to next June 30th ✅ PASS
an approved affiliation a state admin revokes the affiliation error message on request Cannot destructure property 'name' of '(intermediate value)' as it is undefined. ✅ PASS
an approved affiliation a fed admin revokes the affiliation error message on request Cannot destructure property 'name' of '(intermediate value)' as it is undefined. ✅ PASS
an affiliation request a state admin denies it error message on request Cannot destructure property 'name' of '(intermediate value)' as it is undefined. ✅ PASS
an affiliation request a fed admin denies it error message on request Cannot destructure property 'name' of '(intermediate value)' as it is undefined. ✅ PASS

@thetif thetif removed the request for review from knollfear September 7, 2021 18:22
@thetif
Copy link
Contributor

thetif commented Sep 7, 2021

@tbolt this doesn't have to be approved by Jerome so once we have confirmed what the expiration date will be, you can merge it.

@tbolt tbolt merged commit bcea0d2 into development Sep 13, 2021
@tbolt tbolt deleted the tbolt/3298-affiliation-expiration branch September 13, 2021 19:39
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.

[Feature] Add an expiration date to State Staff and State Contractors
5 participants