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

Update annotation project update endpoint. Update status DB trigger #5461

Merged
merged 5 commits into from
Aug 21, 2020

Conversation

aaronxsu
Copy link
Member

@aaronxsu aaronxsu commented Aug 19, 2020

Overview

This PR:

  • updates the annotation project update dao method so that it accepts updating the campaign_id and the captured_at field
  • updates the DB trigger listening to change of annotation_projects so that the associated campaign's project_statuses is in-sync. We used to only listen to UPDATE OF status, now we listen to DELETE as well

Checklist

  • Description of PR is in an appropriate section of the changelog and grouped with similar changes if possible
  • Swagger specification updated
  • New tables and queries have appropriate indices added
  • Any content changes are properly templated using BUILDCONFIG.APP_NAME
  • Any new SQL strings have tests
  • Any new endpoints have scope validation and are included in the integration test csv

Testing Instructions

  • CI should cover the testing of both the dao method update and the DB trigger update
  • Make sure the code change makes sense to you

Closes https://github.com/azavea/earthrise/issues/135

Copy link
Contributor

@jisantuc jisantuc left a comment

Choose a reason for hiding this comment

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

Let me know what you think about the proposed changes -- I'm not sure what the blast radius is for campaign project count stuff (I think it will support future Groundwork campaign stuff as well?) but if it's large I think the tests should be shored up a little bit

@@ -302,6 +302,16 @@ class AnnotationProjectDaoSpec
"Readiness was updated"
)

assert(
afterUpdate.campaignId == annotationProjectUpdate.campaignId,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this technically isn't testing anything, since the test would still pass if the logic to update the campaign ID were removed.. The generator for AnnotationProject.Creates doesn't include a campaign id, so both of them start with None and should end with None.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good call. I will add the campaign portion.

),
user
)
_ <- AnnotationProjectDao.update(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think to show the update it would be good to get the campaign before updating the projects and have an expectation that it should have two waiting projects.

Also, since you're deleting this project anyway and it doesn't affect the expectation, is it correct that the test is the same without this query?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, so I intended to pluck out campaign status in multiple spots before and after the annotation projects' updates, and somehow forgot to do so in the end, this is why you see multiple updates to annotation projects.

This part of logic (in terms of listening to project status updates) has been tested in ER prod for some months now, and it has been working fine. The postgres function updated in PR is just to let it listen to delete actions as well.

I will add more status checks in the next commit.

@aaronxsu
Copy link
Member Author

@jisantuc I'd like to do a slack call with you, since I don't think I fully understood what you meant by the blast radius for the campaign project count stuffs.

@aaronxsu
Copy link
Member Author

aaronxsu commented Aug 21, 2020

Update: we had a successful call on slack, we decided to:

  1. let the DB trigger listen to insert actions on annotation_projects
  2. increase test coverage for campaign status after insert, update, delete of annotation projects

@aaronxsu aaronxsu requested a review from jisantuc August 21, 2020 19:30
Copy link
Contributor

@jisantuc jisantuc left a comment

Choose a reason for hiding this comment

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

Thanks for breaking out the specific changes -- this was really easy to review!

@aaronxsu aaronxsu merged commit 4a99222 into develop Aug 21, 2020
@aaronxsu aaronxsu deleted the feature/asu/update-db-trigger branch August 21, 2020 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants