Indicia-Team / warehouse

GNU General Public License v3.0
5 stars 3 forks source link

Drop sub-sample date and survey requirement #503

Closed kazlauskis closed 11 months ago

kazlauskis commented 12 months ago

The warehouse will reject a POST request to /services/rest/samples like this because a child sub-sample doesn't contain a valid date or a survey. I don't see a reason why a subsample survey could differ from its parent's, and it should be safe to default to the parent survey date if one is missing. Automatically setting these values would clean up and simplify client code in numerous places and help prevent mismatched sample and sub-sample dates.

As a bonus, I would also default the entered_sref values.

{
  "values": {
    "survey_id": "1",
    "entered_sref_system": 4326,
    "entered_sref": "51, 1",
    "date": "5/12/2023"
  },
  "samples": [
    {
      "values": {
        "entered_sref_system": 4326,
        "entered_sref": "51, 1"
      }
    }
  ]
}
kazlauskis commented 11 months ago

Thanks! 🎉

johnvanbreda commented 11 months ago

Just waiting for continuous integration tests - will be deployed in half an hour if OK.