Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePrior committed Aug 26, 2023
2 parents ce5bee9 + 07dd0e0 commit cc914a2
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 21 deletions.
Binary file added public/images/suggestions/aloe-vera.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/avocado.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/basil.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/bean-sprout.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/cabbage.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/carrot.webp
Binary file not shown.
Binary file added public/images/suggestions/celery.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/cherry-tomato.webp
Binary file not shown.
Binary file added public/images/suggestions/chives.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/clinatro.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/mango.webp
Binary file not shown.
Binary file added public/images/suggestions/mint.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/orange.webp
Binary file not shown.
Binary file added public/images/suggestions/oregano.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/parsley.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/rosemary.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/sage.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/strawberry.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/suggestions/thyme.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 19 additions & 19 deletions src/logic/plantData.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"kgz_1": ["A", "B", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/aloe-vera.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -18,7 +18,7 @@
"kgz_1": ["A", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/avocado.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "L",
"pots": false,
Expand All @@ -31,7 +31,7 @@
"kgz_1": ["C"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/basil.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -44,7 +44,7 @@
"kgz_1": ["A", "B", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/bean-sprout.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -57,7 +57,7 @@
"kgz_1": ["C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/cabbage.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "M",
"pots": false,
Expand All @@ -70,7 +70,7 @@
"kgz_1": ["A", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/carrot.webp",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "M",
"pots": false,
Expand All @@ -83,7 +83,7 @@
"kgz_1": ["B", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/celery.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "M",
"pots": false,
Expand All @@ -96,7 +96,7 @@
"kgz_1": ["A", "C"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/cherry-tomato.webp",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -109,7 +109,7 @@
"kgz_1": ["A", "B", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/chives.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -122,7 +122,7 @@
"kgz_1": ["A", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/clinatro.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -135,7 +135,7 @@
"kgz_1": ["A"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/mango.webp",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "L",
"pots": false,
Expand All @@ -148,7 +148,7 @@
"kgz_1": ["A", "C"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/mint.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -161,7 +161,7 @@
"kgz_1": ["A", "C"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/orange.webp",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "L",
"pots": false,
Expand All @@ -174,7 +174,7 @@
"kgz_1": ["A", "B", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/oregano.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -187,7 +187,7 @@
"kgz_1": ["A", "B", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/parsley.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -200,7 +200,7 @@
"kgz_1": ["B", "C"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/rosemary.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -213,7 +213,7 @@
"kgz_1": ["B", "C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/sage.jpeg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand All @@ -226,7 +226,7 @@
"kgz_1": ["C", "D"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/strawberry.jpeg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": false,
Expand All @@ -239,7 +239,7 @@
"kgz_1": ["A", "B", "C"],
"kgz_2": "",
"kgz_3": "",
"image_url": "https://i.pinimg.com/originals/fe/d2/6d/fed26da97c5d28883d8dc8b9b3ca14c2.png",
"image_url": "public/images/suggestions/thyme.jpg",
"description": "placeholder placeholder placeholder placeholder placeholder ",
"space_req": "S",
"pots": true,
Expand Down
6 changes: 4 additions & 2 deletions src/logic/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,13 @@ async function suggestPlants(budget, location, property, time, potted) {
return s.score === max;
});

if (suggestions.length >= 3 && suggestionsMax.length >= 3) {
if (suggestionsMax.length >= 3) {
const shuffledMax = suggestionsMax.sort(() => 0.5 - Math.random());
return shuffledMax.slice(0, 3);
} else {
} else if (suggestions.length >= 3) {
return suggestions.slice(0, 3);
} else {
return suggestions;
}
}

Expand Down

0 comments on commit cc914a2

Please sign in to comment.