Skip to content

Commit c385fab

Browse files
committed
Fix type filter
1 parent ab6caba commit c385fab

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Yummy Changelog
22

3+
## [2.11.2] - 2022-09-07
4+
5+
### Fixed
6+
7+
- [mjkuranda]: Type filter.
8+
39
## [2.11.1] - 2022-09-06
410

511
### Fixed

IDEAS.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,26 @@
77
## Bugs
88

99
- Client validation for an existing meal in the database
10-
- Types has affect on searching results.
11-
- (vNaN): NaN
1210

1311
## Added
1412

15-
v2.8.0:
16-
17-
- Validation - client side: The patterns should be loaded from pattern file? Or simply embedeed inside elements.
18-
- Better handling MongoDB errors - types of errors and their communicates.
19-
- Error page for multer and other errors while you are trying to add a new meal.
20-
21-
v2.9.0
13+
v2.11.0
2214

23-
- Each result has a property called `relevance` - could be measured as a percentage. The found results should be sorted according to the this property.
15+
- Add responsive web design for the other subsites.
2416

2517
v2.10.0
2618

2719
- Add pagination for results.
2820

29-
v2.11.0
21+
v2.9.0
3022

31-
- Add responsive web design for the other subsites.
23+
- Each result has a property called `relevance` - could be measured as a percentage. The found results should be sorted according to the this property.
24+
25+
v2.8.0:
26+
27+
- Validation - client side: The patterns should be loaded from pattern file? Or simply embedeed inside elements.
28+
- Better handling MongoDB errors - types of errors and their communicates.
29+
- Error page for multer and other errors while you are trying to add a new meal.
3230

3331
## Changed
3432

@@ -39,6 +37,10 @@ v2.7.0:
3937

4038
## Fixed
4139

40+
v2.11.2:
41+
42+
- Types has affect on searching results.
43+
4244
v2.6.3:
4345

4446
- When you try to add a new meal and its image is too large, then you receive a message about failure but the meal wil be added.

databases/MongoDB.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,14 @@ class MongoDB implements IDatabase {
3838
}
3939

4040
public async get(query: IQuery): Promise<[Meal]> {
41-
const queryObject: { ingredients: any; types: any } = {
42-
ingredients: undefined,
43-
types: undefined,
44-
};
41+
const queryObject: { ingredients?: any; type?: any } = {};
4542

4643
if (query.ings) {
4744
queryObject.ingredients = { $in: query.ings };
4845
}
4946

5047
if (query.types) {
51-
queryObject.types = { $in: query.types };
48+
queryObject.type = { $in: query.types };
5249
}
5350

5451
const meals = (await MealModel.find(queryObject)) as [Meal];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "yummy",
3-
"version": "2.11.1",
3+
"version": "2.11.2",
44
"description": "Website that will help you the best!",
55
"main": "index.js",
66
"scripts": {

src/YummyRouter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class YummyRouter {
7070
let relevance = 0;
7171

7272
meal.ingredients.forEach((ing) => {
73-
if (ings.includes(ing)) {
73+
if (ings?.includes(ing)) {
7474
relevance++;
7575
}
7676
});

0 commit comments

Comments
 (0)