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

UpdateProgram is setting values to 0 or empty when no value is provided #145

Open
joneubank opened this issue Jul 16, 2019 · 1 comment
Open
Labels
bug Something isn't working

Comments

@joneubank
Copy link
Member

joneubank commented Jul 16, 2019

Describe the bug
When calling the UpdateProgram GRPC service, any field in the input Program object that is left empty (name={} instead of name={value=""}) causes that value in the Program to be set to 0 or "".

This means that to update a single field we need to call GetProgram from Program-Service, provide all the values we want to stay the same, and update the ones we want to change. There should be no need for the client to provide the values that are not changing.

Steps To Reproduce
Steps to reproduce the behaviour:

  1. Call UpdateProgram with the following body :
{
  "program": {
    "short_name": {
      "value": "{{ShortName of a program you don't mind losing data from}}"
    },
    "description": {
      
    },
    "name": {
     
    },
    "membership_type": {
     
    },
    "commitment_donors": {
    
    },
    "submitted_donors": {
      
    },
    "genomic_donors": {
      
    },
    "website": {
      "value": "Hello"
    },
    "institutions": {
     
    },
    "countries": {
      "value": "Hello"
    },
    "regions": {
     
    },
    "cancer_types": [
      
    ],
    "primary_sites": [
      
    ]
  }
}
  1. Call GetProgram for the same program (or check database)
  2. All values of the program are now empty.

Expected behaviour
No changes to the program from before.

Note: I didn't test the above because I don't want to wipe anything, but I hope that illustrates the problem. That should be a valid message body indicating no change to those fields.

Note 2: There is no object wrapper on PrimarySite or CancerType, so there is no way to indicate we don't want to change those. We will also need to modify the message structure to put those in a {value:[]} structure if we want to support this behaviour in UpdateProgram.

@joneubank joneubank added the bug Something isn't working label Jul 16, 2019
@joneubank
Copy link
Member Author

In the gateway we've put a work around in place to deal with the current issue. We call getProgram, get all the values, provide them all with the ones we want to update chagned. Thus, update program is a 2 call action until this is addressed.

@alekspejovic alekspejovic added this to the Code Monkeys - Sprint 10 milestone Jul 22, 2019
@alekspejovic alekspejovic changed the title 🐛 UpdateProgram is setting values to 0 or empty when no value is provided UpdateProgram is setting values to 0 or empty when no value is provided Jul 22, 2019
@alekspejovic alekspejovic removed this from the Code Monkeys - Sprint 10 milestone Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants