File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ describe("calculatePlantPositions()", () => {
1818 icon : CROPS . beet . icon ,
1919 key : "beet" ,
2020 label : "Beet" ,
21+ id : expect . any ( Number ) ,
2122 seed : expect . any ( Number ) ,
2223 size : 150 ,
2324 spread : 175 ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export const calculatePlantPositions = (config: Config): ThreeDGardenPlant[] =>
1010 const startX = 350 ;
1111 let nextX = startX ;
1212 let index = 0 ;
13+ let nextId = 1 ;
1314 while ( nextX <= config . bedLengthOuter - 100 ) {
1415 const plantKey = gardenPlants [ index ] ;
1516 const plant = PLANTS [ plantKey ] ;
@@ -22,6 +23,7 @@ export const calculatePlantPositions = (config: Config): ThreeDGardenPlant[] =>
2223 y : config . bedWidthOuter / 2 ,
2324 key : plantKey ,
2425 seed : Math . random ( ) ,
26+ id : nextId ++ ,
2527 } ) ;
2628 const plantsPerHalfRow =
2729 Math . ceil ( ( config . bedWidthOuter - plant . spread ) / 2 / plant . spread ) ;
@@ -33,6 +35,7 @@ export const calculatePlantPositions = (config: Config): ThreeDGardenPlant[] =>
3335 y : config . bedWidthOuter / 2 + plant . spread * i ,
3436 key : plantKey ,
3537 seed : Math . random ( ) ,
38+ id : nextId ++ ,
3639 } ) ;
3740 positions . push ( {
3841 ...plant ,
@@ -41,6 +44,7 @@ export const calculatePlantPositions = (config: Config): ThreeDGardenPlant[] =>
4144 y : config . bedWidthOuter / 2 - plant . spread * i ,
4245 key : plantKey ,
4346 seed : Math . random ( ) ,
47+ id : nextId ++ ,
4448 } ) ;
4549 }
4650 if ( index + 1 < gardenPlants . length ) {
You can’t perform that action at this time.
0 commit comments