I have a template of exercise with name, description and amount of sets. I want to create multiple objects of Exercise * amount of sets. For example I have template [{ “name” : “Legs”, “sets” : 3 }, { “name” : “Arms”, “sets” : 2 } in DB I want to be saved [ {legs}, {legs}, {legs}, {arms}, {arms}], but only [{legs}, {arms}] are saved.
Fragment of code
In attached screen they are all saved with exerciseId 1024 or 1025 instead of all be unique in range 1024-1028
Zetka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.