PermaplanT icon indicating copy to clipboard operation
PermaplanT copied to clipboard

Set remove_date when creating plantings according to its life_cycle.

Open horenso opened this issue 2 months ago • 0 comments

Summary

Set remove_date automatically according to the plants life cycle. The code is ok but it may be better to change the data type of life_cycles of plants in the db. Option<Vec<Option<LifeCycle>>> is such a ridiculous type, it should be Vec<LifeCycle> if LifeCycle is not enough, or if we prefer nullable (It's a different debate whether nullable strings and lists make sense ever) It can be Option<Vec<LifeCycle>>.

We may want to consider in the database: ife_cycles life_cycle[] NOT NULL DEFAULT ARRAY[]::life_cycle[] and ALTER TABLE plants ADD CONSTRAINT no_null_life_cycles CHECK (NOT ARRAY[NULL] <@ life_cycles);

(If there is no logic reason it be very to create a migration that just the longest life_cycle per plant)

Basics

  • [ ] The PR is rebased with current master
  • [ ] I added a line to changelog.md
  • [ ] Details of what I changed are in the commit messages
  • [ ] References to issues, e.g. close #X, are in the commit messages and changelog
  • [ ] The buildserver is happy

Checklist

  • [ ] I fully described what my PR does in the documentation
  • [ ] I fixed all affected documentation
  • [ ] I fixed the introduction tour
  • [ ] I wrote migrations in a way that they are compatible with already present data
  • [ ] I fixed all affected decisions
  • [ ] I added automated tests or a manual test protocol
  • [ ] I added code comments, logging, and assertions as appropriate
  • [ ] I translated all strings visible to the user
  • [ ] I mentioned every code or binary not directly written or done by me in reuse syntax
  • [ ] I created left-over issues for things that are still to be done
  • [ ] Code is conforming to our Architecture
  • [ ] Code is conforming to our Guidelines
  • [ ] Code is consistent to our Design Decisions
  • [ ] Exceptions to any guidelines are documented

First Time Checklist

Review

  • [ ] I've tested the code via issue description
  • [ ] I've tested the code via requirements
  • [ ] I've tested the code with concurrency (several browsers on the same map)
  • [ ] I've read through the code
  • [ ] I've read through the documentation
  • [ ] I've checked conformity to guidelines
  • [ ] I've checked conformity to requirements
  • [ ] I've checked that the requirements are automatically tested

horenso avatar Apr 22 '24 22:04 horenso