sopra-fs24-group-01 / sopra-fs24-plantparent-server

This is the Spring-based back end for the PlantParent website.
Apache License 2.0
0 stars 1 forks source link

User should not be added twice to the same plant as caretaker #192

Closed Danielgergely closed 4 months ago

Danielgergely commented 4 months ago

A user should not be added to a plant as a caretaker multiple times. If user is added to a space in which there is a plant of which he/she is already caretaker of, then he/she should not be added again as a caretaker. Please implement a check which makes sure that a user will not be added twice to the same plant as a caretaker.

M-Sigg commented 4 months ago

I will do this today

M-Sigg commented 4 months ago

I just went over it and the code already has such a check when calling addPlantToSpace(). I also just added a test to ensure this works.

When did you encounter this bug? Because on my side it seems to work as expected

Danielgergely commented 4 months ago

I just saw that sometimes a plant has the same user more then once in its caretakers list. I think the check you implemented should now prevent this. (It could be that these users were added already before any checks were implemented)