The system should prevent of adding the same ingredient into recipe more than 1 time. For example, if I need to add 100 grams of tomato I must do it with single record. If I create first record for 50 grams of tomato I won't be able to add second record with 50 grams.
You correctly check if we are adding the same ingredient to the recipe. But the validation also prevents editing the existing recipe items.
Steps to reproduce:
Open any existing recipe
Add new recipe items e.g. "Помідор черрі" 1 piece
Try to edit quantity of just added recipe item - you will get an error "this ingradient already exists".
The system should prevent of adding the same ingredient into recipe more than 1 time. For example, if I need to add 100 grams of tomato I must do it with single record. If I create first record for 50 grams of tomato I won't be able to add second record with 50 grams.