Skip to content

Commit

Permalink
add filter to filter out dishes eaten previously today
Browse files Browse the repository at this point in the history
  • Loading branch information
henrychen0220 committed Mar 21, 2019
1 parent 84a6193 commit 798ac1b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
12 changes: 6 additions & 6 deletions new-gui/.expo/packager-info.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"expoServerPort": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null,
"expoServerPort": 19000,
"expoServerNgrokUrl": "https://as-km5.anonymous.new-gui.exp.direct",
"packagerNgrokUrl": "https://packager.as-km5.anonymous.new-gui.exp.direct",
"ngrokPid": 15688,
"devToolsPort": 19002,
"packagerPort": null,
"packagerPid": null,
"packagerPort": 19001,
"packagerPid": 13356,
"webpackServerPort": null
}
4 changes: 2 additions & 2 deletions new-gui/src/commons/serverRequest/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//const HOST = "52.39.77.219";
const HOST = "174.77.40.238";
const HOST = "52.39.77.219";
// const HOST = "192.168.1.8";
export const SERVER_URL = "http://" + HOST + ":8080";
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ else if(cal_target>cal_need*0.3)

List<String> disLikeFoods=currentUserInfo.getDislikeFoods();
List<String> allergies = currentUserInfo.getAllergies();
List<String> foodEatenToday = currentUserInfo.getFoodsEatenCurrently();
List<Bson> filterlist=new ArrayList<Bson>();


Expand All @@ -127,6 +128,11 @@ else if(cal_target>cal_need*0.3)
for (String allergy: allergies) {
filterlist.add(not(regex("ingredients",Pattern.compile("^.*"+ allergy +".*$", Pattern.CASE_INSENSITIVE))));
}

// filter out all foods that is eaten by the user today
for (String food: foodEatenToday) {
filterlist.add(not(eq("title", food)));
}

//System.out.println(and(filterlist).toBsonDocument(BsonDocument.class, com.mongodb.MongoClient.getDefaultCodecRegistry()));
AggregateIterable<FoodInfo> foundFoods = foodCollection.aggregate(
Expand Down

0 comments on commit 798ac1b

Please sign in to comment.