Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

non-perennial plants should be automatically removed #724

Open
2 tasks
markus2330 opened this issue Jul 27, 2023 · 6 comments · May be fixed by #1334
Open
2 tasks

non-perennial plants should be automatically removed #724

markus2330 opened this issue Jul 27, 2023 · 6 comments · May be fixed by #1334
Assignees
Labels
backend changes in Rust code enhancement New feature or request

Comments

@markus2330
Copy link
Contributor

markus2330 commented Jul 27, 2023

Tasks

  • an annual plant, when planted e.g. 1. march 2022, should get 1. march 2023 as removed date
  • an biennial plant, when planted e.g. 1. march 2022, should get 1. march 2024 as removed date

Use case

plant_layer

Related Pull request

No response

@markus2330 markus2330 added the enhancement New feature or request label Jul 27, 2023
@markus2330 markus2330 changed the title non- perennial plants should be automatically removed non-perennial plants should be automatically removed Jul 27, 2023
@markus2330
Copy link
Contributor Author

see also backend/src/model/enum/life_cycle.rs to get more information about life cycle

@markus2330
Copy link
Contributor Author

@tschawax can you please create an issue/PR of what exactly needs to be done in the backend? (also for #727 and so on)

Ideally, it would be a PR with utopia syntax (doesn't need to compile, though) but it can also be an issue describing in prose text how the API should be changed.

This issue/PR is for @horenso, so that he can quickly start (without discussions/uncertainty what is needed) once he is finished with Opensesame.

@markus2330
Copy link
Contributor Author

@horenso as discussed, @tschawax said it might be enough that when creating a plant the removal date is automatically set depending on life cycle to implement this feature.

@horenso
Copy link
Contributor

horenso commented Apr 17, 2024

@markus2330 I just saw that table plants has the properties life_cycle as an array. For instance
Acinos arvensis and Acinos rotundifolius both have the set {annual,perennial}.

(select unique_name, life_cycle from plants)

What should happen then? Should I just do:

pseudo code:

if life_cycle.includes(biennial): set remove_date two years after add_date
if life_cycle.includes(annual): set remove_date one year after add_date
else: don't set remove_date

I don't fully understand how a set of life_times makes sense when the comments read:

    #[serde(rename = "annual")]
    #[db_rename = "annual"]
    /// on the map for current year
    Annual,

    #[serde(rename = "biennial")]
    #[db_rename = "biennial"]
    /// on the map for current and next year
    Biennial,

    #[serde(rename = "perennial")]
    #[db_rename = "perennial"]
    /// on the map until removed by user
    Perennial,

@markus2330
Copy link
Contributor Author

There are 275 plants that have two life_cycle entries. In these cases, use the longest provided life_cycle. i.e.:

  • if perennial -> no remove date
  • if biennial -> set remove date to two years after plant date
  • if annual -> set removed date to one year after plant date
  • else -> no remove date

e.g. in case of Acinos rotundifolius we use perennial, so it should not have a remove date

Please update the code comments.

@horenso
Copy link
Contributor

horenso commented Apr 21, 2024

Thanks for clarifying! PR is incoming shortly 🚀

@horenso horenso linked a pull request Apr 22, 2024 that will close this issue
29 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend changes in Rust code enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants